mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-24 15:54:00 +00:00
Remove wgpu-native and wgpu-remote
This commit is contained in:
parent
6b0751f1f8
commit
dbb261b7f1
@ -1,5 +0,0 @@
|
||||
IndentWidth: 4
|
||||
|
||||
# Reduce left indentation for nested structs
|
||||
AlignOperands: false
|
||||
AlignAfterOpenBracket: DontAlign
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,10 +1,8 @@
|
||||
Cargo.lock
|
||||
/target
|
||||
**/*.rs.bk
|
||||
#Cargo.lock
|
||||
.DS_Store
|
||||
.vscode
|
||||
.vs
|
||||
build
|
||||
ffi/dawn*.h
|
||||
dist
|
||||
.idea
|
||||
|
44
.travis.yml
44
.travis.yml
@ -52,23 +52,11 @@ matrix:
|
||||
- TARGET=aarch64-apple-ios
|
||||
- BUILD_COMMAND=clippy
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- cmake
|
||||
- libglfw3-dev
|
||||
homebrew:
|
||||
update: true
|
||||
packages:
|
||||
- cmake
|
||||
- glfw3
|
||||
|
||||
branches:
|
||||
except:
|
||||
- staging.tmp
|
||||
|
||||
before_install:
|
||||
- if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install make; fi
|
||||
- if [[ $TRAVIS_RUST_VERSION != "nightly" ]] && [[ $TRAVIS_OS_NAME == "windows" ]]; then rustup default stable-msvc; fi
|
||||
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]] && [[ $TRAVIS_OS_NAME == "windows" ]]; then rustup default nightly-msvc; fi
|
||||
|
||||
@ -77,37 +65,5 @@ before_script:
|
||||
|
||||
script:
|
||||
- cargo test
|
||||
# TODO: enable GL backend
|
||||
- (cd wgpu-core && cargo $BUILD_COMMAND --all-features)
|
||||
- (cd wgpu-native && cargo $BUILD_COMMAND)
|
||||
- (cd wgpu-remote && cargo $BUILD_COMMAND --all-features)
|
||||
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then (cd wgpu-native && cargo $BUILD_COMMAND --features vulkan-portability); fi
|
||||
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then cargo $BUILD_COMMAND --release; fi
|
||||
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]]; then cargo +nightly install cbindgen; fi
|
||||
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]] && [[ $TRAVIS_OS_NAME == "windows" ]]; then
|
||||
wget -nc -O glfw.zip https://github.com/glfw/glfw/archive/3.3.zip &&
|
||||
7z x glfw.zip -oglfw &&
|
||||
cd glfw/glfw-3.3 &&
|
||||
export GLFW3_INCLUDE_DIR=`pwd`/include &&
|
||||
export GLFW3_INSTALL_DIR=`pwd`/install &&
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=$GLFW3_INSTALL_DIR -DCMAKE_GENERATOR_PLATFORM=x64 &&
|
||||
cmake --build . --target install &&
|
||||
cd ../.. &&
|
||||
export CMAKE_PREFIX_PATH=$GLFW3_INSTALL_DIR &&
|
||||
make example-compute example-triangle VERBOSE=1;
|
||||
fi
|
||||
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]] && [[ $TRAVIS_OS_NAME != "windows" ]]; then make VERBOSE=1; fi
|
||||
- if [[ $TRAVIS_RUST_VERSION == "stable" ]]; then make package; fi
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: GcBxH6M6X9UU+5QBR4nEdNbXDfGpCrggZkPaztfK1vGAjmOyvHnK6P3M00C5Pf0nLmyWhGT5P0I4Rpy0z8WyQLOaHNWUuRGlRqlehWiJEmi6MpS2O8noJEfbLut9vYPpl0sdrtFrU5e0F77fWm5UWYQLMaeqXj66xv4lVxZp/JkXwhChTpU0PRJtSBuYiLFzbwz9CEjsvBXjw5ZzxmGTHnbw5p19B63yy3mORV91QQrRfCAHMg9z9zthpoZHEGqXXTIFuvh1DZqC5SHhUbt865MHMJS/2IaPH5zA/fOzZCCk6IvbNKLJ/ghE0zRJjHeVU4vjxNMxrFEBKVFCmQB7CpTqGCLy2qTB0tnSmNzqY82xUehl23jZ0LxnKODzCjx4hgfskWnr5p7Pv1Ql9UcAZXDV8UG+7JL34BQY4yyvknpTxK4MTXN9ZNahKJv+zSB9jDuLnB6uVbNV1hwFOUNm7KyAWA7XjFN7k8p4h678Xfg+EUWYxtV1auOItuXdxvzMWgDUDGmk74FdUWxy+GVzjboAmBMVRW/KMQFp4INIaS0gPRPK/jodLqrrZ+1otgYvMM/CsnOh4GLl86RTewuyid2jNnUeXepHPuU+JsDLLCJfyYoAfSxDCdQEuqNLAvpFPJJrBcWREVoqXWVUlWmwhEIWbLRUi2l5AhHnu+PfVhE=
|
||||
skip_cleanup: true
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
file: dist/wgpu-*.zip
|
||||
on:
|
||||
repo: gfx-rs/wgpu
|
||||
tags: true
|
||||
condition: $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_BRANCH == $TRAVIS_TAG && ${TRAVIS_TAG::1} == "v"
|
||||
|
830
Cargo.lock
generated
830
Cargo.lock
generated
@ -1,830 +0,0 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atom"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "battery"
|
||||
version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uom 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "block"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cloudabi"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "copyless"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "d3d12"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types-shared"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "fxhash"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-auxil"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"spirv_cross 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-dx11"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-auxil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"range-alloc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"spirv_cross 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-dx12"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"d3d12 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-auxil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"range-alloc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"spirv_cross 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-empty"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-metal"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cocoa 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-auxil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"metal 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"range-alloc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"spirv_cross 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"storage-map 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-vulkan"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ash 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"x11 2.18.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-descriptor"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-hal"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gfx-memory"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hibitset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hibitset"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mach"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "malloc_buf"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "metal"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cocoa 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc_exception 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_exception"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peek-poke"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"peek-poke-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peek-poke-derive"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "range-alloc"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde_derive 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "spirv_cross"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "storage-map"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "synstructure"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "uom"
|
||||
version = "0.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"battery 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-backend-dx11 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-backend-dx12 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-backend-empty 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-backend-metal 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-backend-vulkan 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-descriptor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx-memory 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"peek-poke 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wgpu-types 0.5.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-native"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wgpu-core 0.5.0",
|
||||
"wgpu-types 0.5.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-remote"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wgpu-core 0.5.0",
|
||||
"wgpu-types 0.5.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-types"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"peek-poke 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "wio"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11"
|
||||
version = "2.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
||||
"checksum ash 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "69daec0742947f33a85931fa3cb0ce5f07929159dcbd1f0cbb5b2912e2978509"
|
||||
"checksum atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2"
|
||||
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
||||
"checksum battery 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "36a698e449024a5d18994a815998bf5e2e4bc1883e35a7d7ba95b6b69ee45907"
|
||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
||||
"checksum bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187"
|
||||
"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
||||
"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
|
||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||
"checksum cocoa 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0a4736c86d51bd878b474400d9ec888156f4037015f5d09794fab9f26eab1ad4"
|
||||
"checksum copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127"
|
||||
"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
|
||||
"checksum core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
|
||||
"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
|
||||
"checksum core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
|
||||
"checksum core-graphics 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "59e78b2e0aaf43f08e7ae0d6bc96895ef72ff0921c7d4ff4762201b2dba376dd"
|
||||
"checksum d3d12 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc7ed48e89905e5e146bcc1951cc3facb9e44aea9adf5dc01078cda1bd24b662"
|
||||
"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
||||
"checksum gfx-auxil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b46e6f0031330a0be08d17820f2dcaaa91cb36710a97a9500cb4f1c36e785c8"
|
||||
"checksum gfx-backend-dx11 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b148219292624126f78245e50a9720d95ea149a415ce8ce73ab7014205301b88"
|
||||
"checksum gfx-backend-dx12 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0e526746379e974501551b08958947e67a81b5ea8cdc717a000cdd72577da05"
|
||||
"checksum gfx-backend-empty 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b67bd2d7bc022b257ddbdabc5fa3b10c29c292372c3409f2b6a6e3f4e11cdb85"
|
||||
"checksum gfx-backend-metal 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cfe128c29675b5afc8acdda1dfe096d6abd5e3528059ab0b98bda8215d8beed9"
|
||||
"checksum gfx-backend-vulkan 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12b0e215ad54ffb7965ffaf6de6d0ec00143952ddf960d7d2255b539d129525d"
|
||||
"checksum gfx-descriptor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1bf35f5d66d1bc56e63e68d7528441453f25992bd954b84309d23c659df2c5da"
|
||||
"checksum gfx-hal 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc96180204064c9493e0fe4a9efeb721e0ac59fe8e1906d0c659142a93114fb1"
|
||||
"checksum gfx-memory 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12e0d05a5a1c849561bcc8b9cc1a79ad7d250c9bae458e1de477e184cd63fc5a"
|
||||
"checksum hibitset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "93a1bb8316a44459a7d14253c4d28dd7395cbd23cc04a68c46e851b8e46d64b1"
|
||||
"checksum js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055"
|
||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
|
||||
"checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0"
|
||||
"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
|
||||
"checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
"checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1"
|
||||
"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
|
||||
"checksum metal 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e198a0ee42bdbe9ef2c09d0b9426f3b2b47d90d93a4a9b0395c4cea605e92dc0"
|
||||
"checksum nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229"
|
||||
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
||||
"checksum objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
|
||||
"checksum objc_exception 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
|
||||
"checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc"
|
||||
"checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"
|
||||
"checksum peek-poke 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d93fd6a575ebf1ac2668d08443c97a22872cfb463fd8b7ddd141e9f6be59af2f"
|
||||
"checksum peek-poke-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6fb44a25c5bba983be0fc8592dfaf3e6d0935ce8be0c6b15b2a39507af34a926"
|
||||
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
||||
"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
|
||||
"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
|
||||
"checksum range-alloc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd5927936723a9e8b715d37d7e4b390455087c4bdf25b9f702309460577b14f9"
|
||||
"checksum raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211"
|
||||
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||
"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
"checksum serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)" = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff"
|
||||
"checksum serde_derive 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)" = "ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8"
|
||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
"checksum smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc"
|
||||
"checksum spirv_cross 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "946216f8793f7199e3ea5b995ee8dc20a0ace1fcf46293a0ef4c17e1d046dbde"
|
||||
"checksum storage-map 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0a4829a5c591dc24a944a736d6b1e4053e51339a79fd5d4702c4c999a9c45e"
|
||||
"checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
|
||||
"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
|
||||
"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
|
||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
"checksum uom 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4cec796ec5f7ac557631709079168286056205c51c60aac33f51764bdc7b8dc4"
|
||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f"
|
||||
"checksum wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd"
|
||||
"checksum wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4"
|
||||
"checksum wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931"
|
||||
"checksum wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639"
|
||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
|
||||
"checksum x11 2.18.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77ecd092546cb16f25783a5451538e73afc8d32e242648d54f4ae5459ba1e773"
|
@ -1,7 +1,5 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"wgpu-core",
|
||||
"wgpu-native",
|
||||
"wgpu-remote",
|
||||
"wgpu-types",
|
||||
]
|
||||
|
117
Makefile
117
Makefile
@ -1,117 +0,0 @@
|
||||
RUST_BACKTRACE:=1
|
||||
EXCLUDES:=
|
||||
|
||||
GENERATOR_PLATFORM:=
|
||||
|
||||
FFI_DIR:=ffi
|
||||
BUILD_DIR:=build
|
||||
CLEAN_FFI_DIR:=
|
||||
CREATE_BUILD_DIR:=
|
||||
|
||||
WILDCARD_WGPU_NATIVE:=$(wildcard wgpu-native/**/*.rs wgpu-core/**/*.rs)
|
||||
WILDCARD_WGPU_REMOTE:=$(wildcard wgpu-remote/**/*.rs wgpu-core/**/*.rs)
|
||||
|
||||
GIT_TAG=$(shell git describe --abbrev=0 --tags)
|
||||
GIT_TAG_FULL=$(shell git describe --tags)
|
||||
OS_NAME=
|
||||
|
||||
ifeq (,$(TARGET))
|
||||
CHECK_TARGET_FLAG=
|
||||
else
|
||||
CHECK_TARGET_FLAG=--target $(TARGET)
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
CLEAN_FFI_DIR=del $(FFI_DIR)\*.* /Q /S
|
||||
CREATE_BUILD_DIR=mkdir $(BUILD_DIR)
|
||||
GENERATOR_PLATFORM=-DCMAKE_GENERATOR_PLATFORM=x64
|
||||
else
|
||||
CLEAN_FFI_DIR=rm $(FFI_DIR)/**
|
||||
CREATE_BUILD_DIR=mkdir -p $(BUILD_DIR)
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
LIB_EXTENSION=dll
|
||||
OS_NAME=windows
|
||||
ZIP_TOOL=7z
|
||||
else
|
||||
UNAME_S:=$(shell uname -s)
|
||||
ZIP_TOOL=zip
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
LIB_EXTENSION=so
|
||||
OS_NAME=linux
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
LIB_EXTENSION=dylib
|
||||
OS_NAME=macos
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: all check test doc clear \
|
||||
example-compute example-triangle example-remote \
|
||||
run-example-compute run-example-triangle run-example-remote \
|
||||
lib-native lib-native-release \
|
||||
lib-remote
|
||||
|
||||
#TODO: example-remote
|
||||
all: example-compute example-triangle lib-remote
|
||||
|
||||
package: lib-native lib-native-release
|
||||
mkdir -p dist
|
||||
echo "$(GIT_TAG_FULL)" > dist/commit-sha
|
||||
for RELEASE in debug release; do \
|
||||
ARCHIVE=wgpu-$$RELEASE-$(OS_NAME)-$(GIT_TAG).zip; \
|
||||
rm -f dist/$$ARCHIVE; \
|
||||
if [ $(ZIP_TOOL) = zip ]; then \
|
||||
zip -j dist/$$ARCHIVE target/$$RELEASE/libwgpu_*.$(LIB_EXTENSION) ffi/*.h dist/commit-sha; \
|
||||
else \
|
||||
7z a -tzip dist/$$ARCHIVE ./target/$$RELEASE/wgpu_*.$(LIB_EXTENSION) ./ffi/*.h ./dist/commit-sha; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check:
|
||||
cargo check --all
|
||||
|
||||
test:
|
||||
cargo test --all
|
||||
|
||||
doc:
|
||||
cargo doc --all
|
||||
|
||||
clear:
|
||||
cargo clean
|
||||
$(CLEAN_FFI_DIR)
|
||||
|
||||
lib-native: Cargo.lock wgpu-native/Cargo.toml $(WILDCARD_WGPU_NATIVE)
|
||||
cargo build --manifest-path wgpu-native/Cargo.toml
|
||||
|
||||
lib-native-release: Cargo.lock wgpu-native/Cargo.toml $(WILDCARD_WGPU_NATIVE)
|
||||
cargo build --manifest-path wgpu-native/Cargo.toml --release
|
||||
|
||||
lib-remote: Cargo.lock wgpu-remote/Cargo.toml $(WILDCARD_WGPU_REMOTE)
|
||||
cargo build --manifest-path wgpu-remote/Cargo.toml
|
||||
|
||||
$(FFI_DIR)/wgpu.h: wgpu-native/cbindgen.toml $(WILDCARD_WGPU_NATIVE)
|
||||
rustup run nightly cbindgen -o $(FFI_DIR)/wgpu.h wgpu-native
|
||||
|
||||
$(FFI_DIR)/wgpu-remote.h: wgpu-remote/cbindgen.toml $(WILDCARD_WGPU_REMOTE)
|
||||
rustup run nightly cbindgen -o $(FFI_DIR)/wgpu-remote.h wgpu-remote
|
||||
|
||||
example-compute: lib-native $(FFI_DIR)/wgpu.h examples/compute/main.c
|
||||
cd examples/compute && $(CREATE_BUILD_DIR) && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. $(GENERATOR_PLATFORM) && cmake --build .
|
||||
|
||||
run-example-compute: example-compute
|
||||
cd examples/compute/build && ./compute 1 2 3 4
|
||||
|
||||
example-triangle: lib-native $(FFI_DIR)/wgpu.h examples/triangle/main.c
|
||||
cd examples/triangle && $(CREATE_BUILD_DIR) && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. $(GENERATOR_PLATFORM) && cmake --build .
|
||||
|
||||
run-example-triangle: example-triangle
|
||||
cd examples/triangle/build && ./triangle
|
||||
|
||||
example-remote: lib-remote $(FFI_DIR)/wgpu-remote.h examples/remote/main.c
|
||||
cd examples/remote && $(CREATE_BUILD_DIR) && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. $(GENERATOR_PLATFORM) && cmake --build .
|
||||
|
||||
run-example-remote: example-remote
|
||||
cd examples/remote/build && ./remote
|
22
README.md
22
README.md
@ -9,22 +9,16 @@ This is an active GitHub mirror of the WebGPU implementation in Rust, which now
|
||||
[![Crates.io](https://img.shields.io/crates/v/wgpu-core.svg?label=wgpu-core)](https://crates.io/crates/wgpu-core)
|
||||
[![Crates.io](https://img.shields.io/crates/v/wgpu-native.svg?label=wgpu-native)](https://crates.io/crates/wgpu-native)
|
||||
|
||||
This is an experimental [WebGPU](https://www.w3.org/community/gpu/) implementation, exposing both Rust and C interfaces as a native static library. It's written in Rust and is based on [gfx-hal](https://github.com/gfx-rs/gfx) with help of [gfx-extras](https://github.com/gfx-rs/gfx-extras). See the upstream [WebGPU specification](https://gpuweb.github.io/gpuweb/) (work in progress).
|
||||
This is the core logic of an experimental [WebGPU](https://www.w3.org/community/gpu/) implementation. It's written in Rust and is based on [gfx-hal](https://github.com/gfx-rs/gfx) with help of [gfx-extras](https://github.com/gfx-rs/gfx-extras). See the upstream [WebGPU specification](https://gpuweb.github.io/gpuweb/) (work in progress).
|
||||
|
||||
The implementation consists of the following parts:
|
||||
|
||||
1. `wgpu-core` - internal Rust API for WebGPU implementations to use
|
||||
2. `wgpu-native` - the native implementation of WebGPU as a C API library
|
||||
3. `wgpu-remote` - remoting layer to work with WebGPU across the process boundary, as a C API library used by Gecko
|
||||
4. `wgpu-types` - Rust types shared between `wgpu-core`, `wgpu-native`, `wgpu-remote`, and [`wgpu-rs`](https://github.com/gfx-rs/wgpu-rs)
|
||||
5. `ffi` - the C headers generated by [cbindgen](https://github.com/eqrion/cbindgen) for the native headers
|
||||
- `wgpu-core` - internal Rust API for WebGPU implementations to use
|
||||
- `wgpu-types` - Rust types shared between `wgpu-core`, `wgpu-native`, and `wgpu-rs`
|
||||
|
||||
# Bindings
|
||||
|
||||
- [gfx-rs/wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - idiomatic Rust wrapper with [a few more examples](https://github.com/gfx-rs/wgpu-rs/tree/master/examples) to get a feel of the API
|
||||
- [almarklein/wgpu-py](https://github.com/almarklein/wgpu-py) - experimental Python wrapper
|
||||
- [porky11/wgpu](https://nest.pijul.com/porky11/wgpu) - experimental [Scopes](http://scopes.rocks) wrapper
|
||||
- [cshenton/WebGPU.jl](https://github.com/cshenton/WebGPU.jl) - experimental Julia wrapper
|
||||
This repository is not meant for direct use by applications.
|
||||
If you are looking for the user-facing Rust API, you need [wgpu-rs](https://github.com/gfx-rs/wgpu-rs).
|
||||
If you are looking for the native implementation or bindings to the API in other languages, you need [wgpu-native](https://github.com/gfx-rs/wgpu-native).
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
@ -37,7 +31,3 @@ The implementation consists of the following parts:
|
||||
OpenGL | :construction: | :construction: | :construction: |
|
||||
|
||||
:heavy_check_mark: = Primary support — :white_check_mark: = Secondary support — :construction: = Unsupported, but support in progress
|
||||
|
||||
## Usage
|
||||
|
||||
This repository contains C-language examples that link to the native library targets and perform basic rendering and computation. Please refer to our [Getting Started](https://github.com/gfx-rs/wgpu/wiki/Getting-Started#getting-started) page at the wiki for more information.
|
||||
|
@ -1,34 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.11b)
|
||||
|
||||
project(compute)
|
||||
|
||||
set(TARGET_NAME compute)
|
||||
|
||||
add_executable(compute main.c ../framework.c)
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-DWGPU_TARGET=WGPU_TARGET_WINDOWS)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE /W4)
|
||||
set(OS_LIBRARIES "userenv" "ws2_32" "Dwmapi" "dbghelp" "d3dcompiler" "D3D12" "D3D11" "DXGI" "setupapi")
|
||||
elseif(APPLE)
|
||||
add_definitions(-DWGPU_TARGET=WGPU_TARGET_MACOS)
|
||||
set(OS_LIBRARIES "-framework Cocoa" "-framework CoreVideo" "-framework IOKit" "-framework QuartzCore")
|
||||
target_compile_options(${TARGET_NAME} PRIVATE -x objective-c)
|
||||
else(MSVC)
|
||||
add_definitions(-DWGPU_TARGET=WGPU_TARGET_LINUX)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE -Wall -Wextra -pedantic)
|
||||
endif(MSVC)
|
||||
|
||||
find_package(glfw3 3.3 REQUIRED
|
||||
HINTS "$ENV{GLFW3_INSTALL_DIR}"
|
||||
)
|
||||
|
||||
find_library(WGPU_LIBRARY wgpu_native
|
||||
HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug"
|
||||
)
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC $ENV{GLFW3_INCLUDE_DIR})
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../ffi)
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} glfw ${WGPU_LIBRARY} ${OS_LIBRARIES})
|
@ -1,153 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef WGPU_H
|
||||
#define WGPU_H
|
||||
#include "wgpu.h"
|
||||
#endif
|
||||
|
||||
#include "framework.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BIND_ENTRIES_LENGTH (1)
|
||||
#define BIND_GROUP_LAYOUTS_LENGTH (1)
|
||||
|
||||
void request_adapter_callback(WGPUAdapterId received, void *userdata) {
|
||||
*(WGPUAdapterId*)userdata = received;
|
||||
}
|
||||
|
||||
void read_buffer_map(
|
||||
WGPUBufferMapAsyncStatus status,
|
||||
const uint8_t *data,
|
||||
uint8_t *userdata) {
|
||||
(void)userdata;
|
||||
if (status == WGPUBufferMapAsyncStatus_Success) {
|
||||
uint32_t *times = (uint32_t *) data;
|
||||
printf("Times: [%d, %d, %d, %d]\n",
|
||||
times[0],
|
||||
times[1],
|
||||
times[2],
|
||||
times[3]);
|
||||
}
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[]) {
|
||||
|
||||
if (argc != 5) {
|
||||
printf("You must pass 4 positive integers!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t numbers[] = {
|
||||
strtoul(argv[1], NULL, 0),
|
||||
strtoul(argv[2], NULL, 0),
|
||||
strtoul(argv[3], NULL, 0),
|
||||
strtoul(argv[4], NULL, 0),
|
||||
};
|
||||
|
||||
uint32_t size = sizeof(numbers);
|
||||
|
||||
uint32_t numbers_length = size / sizeof(uint32_t);
|
||||
|
||||
WGPUAdapterId adapter = { 0 };
|
||||
wgpu_request_adapter_async(
|
||||
NULL,
|
||||
2 | 4 | 8,
|
||||
request_adapter_callback,
|
||||
(void *) &adapter
|
||||
);
|
||||
|
||||
WGPUDeviceId device = wgpu_adapter_request_device(adapter, NULL);
|
||||
|
||||
uint8_t *staging_memory;
|
||||
|
||||
WGPUBufferId buffer = wgpu_device_create_buffer_mapped(device,
|
||||
&(WGPUBufferDescriptor){
|
||||
.label = "buffer",
|
||||
.size = size,
|
||||
.usage = WGPUBufferUsage_STORAGE | WGPUBufferUsage_MAP_READ},
|
||||
&staging_memory);
|
||||
|
||||
memcpy((uint32_t *) staging_memory, numbers, size);
|
||||
|
||||
wgpu_buffer_unmap(buffer);
|
||||
|
||||
WGPUBindGroupLayoutId bind_group_layout =
|
||||
wgpu_device_create_bind_group_layout(device,
|
||||
&(WGPUBindGroupLayoutDescriptor){
|
||||
.label = "bind group layout",
|
||||
.entries = &(WGPUBindGroupLayoutEntry){
|
||||
.binding = 0,
|
||||
.visibility = WGPUShaderStage_COMPUTE,
|
||||
.ty = WGPUBindingType_StorageBuffer},
|
||||
.entries_length = BIND_ENTRIES_LENGTH});
|
||||
|
||||
WGPUBindingResource resource = {
|
||||
.tag = WGPUBindingResource_Buffer,
|
||||
.buffer = {(WGPUBufferBinding){
|
||||
.buffer = buffer,
|
||||
.size = size,
|
||||
.offset = 0}}};
|
||||
|
||||
WGPUBindGroupId bind_group = wgpu_device_create_bind_group(device,
|
||||
&(WGPUBindGroupDescriptor){
|
||||
.label = "bind group",
|
||||
.layout = bind_group_layout,
|
||||
.entries = &(WGPUBindGroupEntry){
|
||||
.binding = 0,
|
||||
.resource = resource},
|
||||
.entries_length = BIND_ENTRIES_LENGTH});
|
||||
|
||||
WGPUBindGroupLayoutId bind_group_layouts[BIND_GROUP_LAYOUTS_LENGTH] = {
|
||||
bind_group_layout};
|
||||
|
||||
WGPUPipelineLayoutId pipeline_layout =
|
||||
wgpu_device_create_pipeline_layout(device,
|
||||
&(WGPUPipelineLayoutDescriptor){
|
||||
.bind_group_layouts = bind_group_layouts,
|
||||
.bind_group_layouts_length = BIND_GROUP_LAYOUTS_LENGTH});
|
||||
|
||||
WGPUShaderModuleId shader_module = wgpu_device_create_shader_module(device,
|
||||
&(WGPUShaderModuleDescriptor){
|
||||
.code = read_file("./../../data/collatz.comp.spv")});
|
||||
|
||||
WGPUComputePipelineId compute_pipeline =
|
||||
wgpu_device_create_compute_pipeline(device,
|
||||
&(WGPUComputePipelineDescriptor){
|
||||
.layout = pipeline_layout,
|
||||
.compute_stage = (WGPUProgrammableStageDescriptor){
|
||||
.module = shader_module,
|
||||
.entry_point = "main"
|
||||
}});
|
||||
|
||||
WGPUCommandEncoderId encoder = wgpu_device_create_command_encoder(
|
||||
device, &(WGPUCommandEncoderDescriptor){
|
||||
.label = "command encoder",
|
||||
});
|
||||
|
||||
WGPUComputePassId command_pass =
|
||||
wgpu_command_encoder_begin_compute_pass(encoder, NULL);
|
||||
wgpu_compute_pass_set_pipeline(command_pass, compute_pipeline);
|
||||
|
||||
wgpu_compute_pass_set_bind_group(command_pass, 0, bind_group, NULL, 0);
|
||||
wgpu_compute_pass_dispatch(command_pass, numbers_length, 1, 1);
|
||||
wgpu_compute_pass_end_pass(command_pass);
|
||||
|
||||
WGPUQueueId queue = wgpu_device_get_default_queue(device);
|
||||
|
||||
WGPUCommandBufferId command_buffer = wgpu_command_encoder_finish(encoder, NULL);
|
||||
|
||||
wgpu_queue_submit(queue, &command_buffer, 1);
|
||||
|
||||
wgpu_buffer_map_read_async(buffer, 0, size, read_buffer_map, NULL);
|
||||
|
||||
wgpu_device_poll(device, true);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
#version 450
|
||||
layout(local_size_x = 1) in;
|
||||
|
||||
layout(set = 0, binding = 0) buffer PrimeIndices {
|
||||
uint[] indices;
|
||||
}; // this is used as both input and output for convenience
|
||||
|
||||
// The Collatz Conjecture states that for any integer n:
|
||||
// If n is even, n = n/2
|
||||
// If n is odd, n = 3n+1
|
||||
// And repeat this process for each new n, you will always eventually reach 1.
|
||||
// Though the conjecture has not been proven, no counterexample has ever been found.
|
||||
// This function returns how many times this recurrence needs to be applied to reach 1.
|
||||
uint collatz_iterations(uint n) {
|
||||
uint i = 0;
|
||||
while(n != 1) {
|
||||
if (mod(n, 2) == 0) {
|
||||
n = n / 2;
|
||||
}
|
||||
else {
|
||||
n = (3 * n) + 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void main() {
|
||||
uint index = gl_GlobalInvocationID.x;
|
||||
indices[index] = collatz_iterations(indices[index]);
|
||||
}
|
Binary file not shown.
@ -1,7 +0,0 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
outColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
Binary file not shown.
@ -1,15 +0,0 @@
|
||||
#version 450
|
||||
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
const vec2 positions[3] = vec2[3](
|
||||
vec2(0.0, -0.5),
|
||||
vec2(0.5, 0.5),
|
||||
vec2(-0.5, 0.5)
|
||||
);
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
|
||||
}
|
Binary file not shown.
@ -1,29 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef WGPU_H
|
||||
#define WGPU_H
|
||||
#include "wgpu.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
WGPUU32Array read_file(const char *name) {
|
||||
FILE *file = fopen(name, "rb");
|
||||
if (!file) {
|
||||
printf("Unable to open %s\n", name);
|
||||
exit(1);
|
||||
}
|
||||
fseek(file, 0, SEEK_END);
|
||||
long length = ftell(file);
|
||||
unsigned char *bytes = malloc(length);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
fread(bytes, 1, length, file);
|
||||
fclose(file);
|
||||
return (WGPUU32Array){
|
||||
.bytes = (uint32_t*) bytes,
|
||||
.length = length / 4,
|
||||
};
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef WGPU_H
|
||||
#define WGPU_H
|
||||
#include "wgpu.h"
|
||||
#endif
|
||||
|
||||
WGPUU32Array read_file(const char *name);
|
||||
|
||||
void read_buffer_map(
|
||||
WGPUBufferMapAsyncStatus status,
|
||||
const uint8_t *data,
|
||||
uint8_t *userdata);
|
@ -1,15 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.11b)
|
||||
|
||||
project(remote)
|
||||
|
||||
set(TARGET_NAME remote)
|
||||
|
||||
add_executable(remote main.c)
|
||||
|
||||
find_package(glfw3)
|
||||
|
||||
find_library(WGPU_LIBRARY wgpu_remote
|
||||
HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug"
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${WGPU_LIBRARY})
|
@ -1,57 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#define WGPU_INLINE
|
||||
#define WGPU_FUNC
|
||||
|
||||
#include "./../../ffi/wgpu-remote.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
WGPUInfrastructure infra = wgpu_client_new();
|
||||
WGPUClient *client = infra.client;
|
||||
|
||||
if (!client || infra.error) {
|
||||
printf("Cannot initialize WGPU client: %s\n", infra.error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
WGPUGlobal* server = wgpu_server_new();
|
||||
|
||||
if (!server) {
|
||||
printf("Cannot initialize WGPU client: %s\n", server);
|
||||
return 1;
|
||||
}
|
||||
|
||||
WGPUAdapterId adapterId = 0;
|
||||
{
|
||||
WGPUAdapterId ids[10];
|
||||
int count = wgpu_client_make_adapter_ids(client, ids, 10);
|
||||
|
||||
WGPURequestAdapterOptions options = {
|
||||
.power_preference = WGPUPowerPreference_LowPower,
|
||||
};
|
||||
char index = wgpu_server_instance_request_adapter(server, &options, ids, count);
|
||||
if (index < 0) {
|
||||
printf("No available GPU adapters!\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
wgpu_client_kill_adapter_ids(client, ids, index);
|
||||
wgpu_client_kill_adapter_ids(client, ids+index+1, count-index-1);
|
||||
adapterId = ids[index];
|
||||
}
|
||||
|
||||
//TODO: do something meaningful
|
||||
|
||||
if (adapterId) {
|
||||
//wgpu_server_destroy_adapter()
|
||||
wgpu_client_kill_adapter_ids(client, &adapterId, 1);
|
||||
}
|
||||
wgpu_server_delete(server);
|
||||
wgpu_client_delete(client);
|
||||
|
||||
printf("Done\n");
|
||||
return 0;
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.11b)
|
||||
|
||||
project(triangle)
|
||||
|
||||
set(TARGET_NAME triangle)
|
||||
|
||||
add_executable(triangle main.c ../framework.c)
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-DWGPU_TARGET=WGPU_TARGET_WINDOWS)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE /W4)
|
||||
set(OS_LIBRARIES "userenv" "ws2_32" "Dwmapi" "dbghelp" "d3dcompiler" "D3D12" "D3D11" "DXGI" "setupapi")
|
||||
elseif(APPLE)
|
||||
add_definitions(-DWGPU_TARGET=WGPU_TARGET_MACOS)
|
||||
set(OS_LIBRARIES "-framework Cocoa" "-framework CoreVideo" "-framework IOKit" "-framework QuartzCore")
|
||||
target_compile_options(${TARGET_NAME} PRIVATE -x objective-c)
|
||||
else(MSVC)
|
||||
if(USE_WAYLAND)
|
||||
add_definitions(-DWGPU_TARGET=WGPU_TARGET_LINUX_WAYLAND)
|
||||
else(USE_WAYLAND)
|
||||
add_definitions(-DWGPU_TARGET=WGPU_TARGET_LINUX_X11)
|
||||
endif(USE_WAYLAND)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE -Wall -Wextra -pedantic)
|
||||
endif(MSVC)
|
||||
|
||||
find_package(glfw3 3.3 REQUIRED
|
||||
HINTS "$ENV{GLFW3_INSTALL_DIR}"
|
||||
)
|
||||
|
||||
find_library(WGPU_LIBRARY wgpu_native
|
||||
HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug"
|
||||
)
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC $ENV{GLFW3_INCLUDE_DIR})
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../ffi)
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} glfw ${WGPU_LIBRARY} ${OS_LIBRARIES})
|
@ -1,279 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef WGPU_H
|
||||
#define WGPU_H
|
||||
#include "wgpu.h"
|
||||
#endif
|
||||
|
||||
#include "framework.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define WGPU_TARGET_MACOS 1
|
||||
#define WGPU_TARGET_LINUX_X11 2
|
||||
#define WGPU_TARGET_WINDOWS 3
|
||||
#define WGPU_TARGET_LINUX_WAYLAND 4
|
||||
|
||||
#if WGPU_TARGET == WGPU_TARGET_MACOS
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <QuartzCore/CAMetalLayer.h>
|
||||
#endif
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#if WGPU_TARGET == WGPU_TARGET_MACOS
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#elif WGPU_TARGET == WGPU_TARGET_LINUX_X11
|
||||
#define GLFW_EXPOSE_NATIVE_X11
|
||||
#elif WGPU_TARGET == WGPU_TARGET_LINUX_WAYLAND
|
||||
#define GLFW_EXPOSE_NATIVE_WAYLAND
|
||||
#elif WGPU_TARGET == WGPU_TARGET_WINDOWS
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#endif
|
||||
#include <GLFW/glfw3native.h>
|
||||
|
||||
#define BLEND_STATES_LENGTH (1)
|
||||
#define ATTACHMENTS_LENGTH (1)
|
||||
#define RENDER_PASS_ATTACHMENTS_LENGTH (1)
|
||||
#define BIND_GROUP_LAYOUTS_LENGTH (1)
|
||||
|
||||
void request_adapter_callback(WGPUAdapterId received, void *userdata) {
|
||||
*(WGPUAdapterId*)userdata = received;
|
||||
}
|
||||
|
||||
int main() {
|
||||
if (!glfwInit()) {
|
||||
printf("Cannot initialize glfw");
|
||||
return 1;
|
||||
}
|
||||
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
GLFWwindow *window =
|
||||
glfwCreateWindow(640, 480, "wgpu with glfw", NULL, NULL);
|
||||
|
||||
if (!window) {
|
||||
printf("Cannot create window");
|
||||
return 1;
|
||||
}
|
||||
|
||||
WGPUSurfaceId surface;
|
||||
|
||||
#if WGPU_TARGET == WGPU_TARGET_MACOS
|
||||
{
|
||||
id metal_layer = NULL;
|
||||
NSWindow *ns_window = glfwGetCocoaWindow(window);
|
||||
[ns_window.contentView setWantsLayer:YES];
|
||||
metal_layer = [CAMetalLayer layer];
|
||||
[ns_window.contentView setLayer:metal_layer];
|
||||
surface = wgpu_create_surface_from_metal_layer(metal_layer);
|
||||
}
|
||||
#elif WGPU_TARGET == WGPU_TARGET_LINUX_X11
|
||||
{
|
||||
Display *x11_display = glfwGetX11Display();
|
||||
Window x11_window = glfwGetX11Window(window);
|
||||
surface = wgpu_create_surface_from_xlib((const void **)x11_display, x11_window);
|
||||
}
|
||||
#elif WGPU_TARGET == WGPU_TARGET_LINUX_WAYLAND
|
||||
{
|
||||
struct wl_display *wayland_display = glfwGetWaylandDisplay();
|
||||
struct wl_surface *wayland_surface = glfwGetWaylandWindow(window);
|
||||
surface = wgpu_create_surface_from_wayland(wayland_surface, wayland_display);
|
||||
}
|
||||
#elif WGPU_TARGET == WGPU_TARGET_WINDOWS
|
||||
{
|
||||
HWND hwnd = glfwGetWin32Window(window);
|
||||
HINSTANCE hinstance = GetModuleHandle(NULL);
|
||||
surface = wgpu_create_surface_from_windows_hwnd(hinstance, hwnd);
|
||||
}
|
||||
#else
|
||||
#error "Unsupported WGPU_TARGET"
|
||||
#endif
|
||||
|
||||
WGPUAdapterId adapter = { 0 };
|
||||
wgpu_request_adapter_async(
|
||||
&(WGPURequestAdapterOptions){
|
||||
.power_preference = WGPUPowerPreference_LowPower,
|
||||
.compatible_surface = surface,
|
||||
},
|
||||
2 | 4 | 8,
|
||||
request_adapter_callback,
|
||||
(void *) &adapter
|
||||
);
|
||||
|
||||
WGPUDeviceId device = wgpu_adapter_request_device(adapter,
|
||||
&(WGPUDeviceDescriptor){
|
||||
.extensions =
|
||||
{
|
||||
.anisotropic_filtering = false,
|
||||
},
|
||||
.limits =
|
||||
{
|
||||
.max_bind_groups = 1,
|
||||
},
|
||||
});
|
||||
|
||||
WGPUShaderModuleId vertex_shader = wgpu_device_create_shader_module(device,
|
||||
&(WGPUShaderModuleDescriptor){
|
||||
.code = read_file("./../../data/triangle.vert.spv"),
|
||||
});
|
||||
|
||||
WGPUShaderModuleId fragment_shader =
|
||||
wgpu_device_create_shader_module(device,
|
||||
&(WGPUShaderModuleDescriptor){
|
||||
.code = read_file("./../../data/triangle.frag.spv"),
|
||||
});
|
||||
|
||||
WGPUBindGroupLayoutId bind_group_layout =
|
||||
wgpu_device_create_bind_group_layout(device,
|
||||
&(WGPUBindGroupLayoutDescriptor){
|
||||
.label = "bind group layout",
|
||||
.entries = NULL,
|
||||
.entries_length = 0,
|
||||
});
|
||||
WGPUBindGroupId bind_group =
|
||||
wgpu_device_create_bind_group(device,
|
||||
&(WGPUBindGroupDescriptor){
|
||||
.label = "bind group",
|
||||
.layout = bind_group_layout,
|
||||
.entries = NULL,
|
||||
.entries_length = 0,
|
||||
});
|
||||
|
||||
WGPUBindGroupLayoutId bind_group_layouts[BIND_GROUP_LAYOUTS_LENGTH] = {
|
||||
bind_group_layout};
|
||||
|
||||
WGPUPipelineLayoutId pipeline_layout =
|
||||
wgpu_device_create_pipeline_layout(device,
|
||||
&(WGPUPipelineLayoutDescriptor){
|
||||
.bind_group_layouts = bind_group_layouts,
|
||||
.bind_group_layouts_length = BIND_GROUP_LAYOUTS_LENGTH,
|
||||
});
|
||||
|
||||
WGPURenderPipelineId render_pipeline =
|
||||
wgpu_device_create_render_pipeline(device,
|
||||
&(WGPURenderPipelineDescriptor){
|
||||
.layout = pipeline_layout,
|
||||
.vertex_stage =
|
||||
(WGPUProgrammableStageDescriptor){
|
||||
.module = vertex_shader,
|
||||
.entry_point = "main",
|
||||
},
|
||||
.fragment_stage =
|
||||
&(WGPUProgrammableStageDescriptor){
|
||||
.module = fragment_shader,
|
||||
.entry_point = "main",
|
||||
},
|
||||
.rasterization_state =
|
||||
&(WGPURasterizationStateDescriptor){
|
||||
.front_face = WGPUFrontFace_Ccw,
|
||||
.cull_mode = WGPUCullMode_None,
|
||||
.depth_bias = 0,
|
||||
.depth_bias_slope_scale = 0.0,
|
||||
.depth_bias_clamp = 0.0,
|
||||
},
|
||||
.primitive_topology = WGPUPrimitiveTopology_TriangleList,
|
||||
.color_states =
|
||||
&(WGPUColorStateDescriptor){
|
||||
.format = WGPUTextureFormat_Bgra8Unorm,
|
||||
.alpha_blend =
|
||||
(WGPUBlendDescriptor){
|
||||
.src_factor = WGPUBlendFactor_One,
|
||||
.dst_factor = WGPUBlendFactor_Zero,
|
||||
.operation = WGPUBlendOperation_Add,
|
||||
},
|
||||
.color_blend =
|
||||
(WGPUBlendDescriptor){
|
||||
.src_factor = WGPUBlendFactor_One,
|
||||
.dst_factor = WGPUBlendFactor_Zero,
|
||||
.operation = WGPUBlendOperation_Add,
|
||||
},
|
||||
.write_mask = WGPUColorWrite_ALL,
|
||||
},
|
||||
.color_states_length = 1,
|
||||
.depth_stencil_state = NULL,
|
||||
.vertex_state =
|
||||
(WGPUVertexStateDescriptor){
|
||||
.index_format = WGPUIndexFormat_Uint16,
|
||||
.vertex_buffers = NULL,
|
||||
.vertex_buffers_length = 0,
|
||||
},
|
||||
.sample_count = 1,
|
||||
});
|
||||
|
||||
int prev_width = 0;
|
||||
int prev_height = 0;
|
||||
glfwGetWindowSize(window, &prev_width, &prev_height);
|
||||
|
||||
WGPUSwapChainId swap_chain = wgpu_device_create_swap_chain(device, surface,
|
||||
&(WGPUSwapChainDescriptor){
|
||||
.usage = WGPUTextureUsage_OUTPUT_ATTACHMENT,
|
||||
.format = WGPUTextureFormat_Bgra8Unorm,
|
||||
.width = prev_width,
|
||||
.height = prev_height,
|
||||
.present_mode = WGPUPresentMode_Fifo,
|
||||
});
|
||||
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
if (width != prev_width || height != prev_height) {
|
||||
prev_width = width;
|
||||
prev_height = height;
|
||||
|
||||
swap_chain = wgpu_device_create_swap_chain(device, surface,
|
||||
&(WGPUSwapChainDescriptor){
|
||||
.usage = WGPUTextureUsage_OUTPUT_ATTACHMENT,
|
||||
.format = WGPUTextureFormat_Bgra8Unorm,
|
||||
.width = width,
|
||||
.height = height,
|
||||
.present_mode = WGPUPresentMode_Fifo,
|
||||
});
|
||||
}
|
||||
|
||||
WGPUSwapChainOutput next_texture =
|
||||
wgpu_swap_chain_get_next_texture(swap_chain);
|
||||
if (!next_texture.view_id) {
|
||||
printf("Cannot acquire next swap chain texture");
|
||||
return 1;
|
||||
}
|
||||
|
||||
WGPUCommandEncoderId cmd_encoder = wgpu_device_create_command_encoder(
|
||||
device, &(WGPUCommandEncoderDescriptor){.label = "command encoder"});
|
||||
|
||||
WGPURenderPassColorAttachmentDescriptor
|
||||
color_attachments[ATTACHMENTS_LENGTH] = {
|
||||
{
|
||||
.attachment = next_texture.view_id,
|
||||
.load_op = WGPULoadOp_Clear,
|
||||
.store_op = WGPUStoreOp_Store,
|
||||
.clear_color = WGPUColor_GREEN,
|
||||
},
|
||||
};
|
||||
|
||||
WGPURenderPassId rpass =
|
||||
wgpu_command_encoder_begin_render_pass(cmd_encoder,
|
||||
&(WGPURenderPassDescriptor){
|
||||
.color_attachments = color_attachments,
|
||||
.color_attachments_length = RENDER_PASS_ATTACHMENTS_LENGTH,
|
||||
.depth_stencil_attachment = NULL,
|
||||
});
|
||||
|
||||
wgpu_render_pass_set_pipeline(rpass, render_pipeline);
|
||||
wgpu_render_pass_set_bind_group(rpass, 0, bind_group, NULL, 0);
|
||||
wgpu_render_pass_draw(rpass, 3, 1, 0, 0);
|
||||
WGPUQueueId queue = wgpu_device_get_default_queue(device);
|
||||
wgpu_render_pass_end_pass(rpass);
|
||||
WGPUCommandBufferId cmd_buf = wgpu_command_encoder_finish(cmd_encoder, NULL);
|
||||
wgpu_queue_submit(queue, &cmd_buf, 1);
|
||||
wgpu_swap_chain_present(swap_chain);
|
||||
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
}
|
1453
ffi/wgpu-remote.h
1453
ffi/wgpu-remote.h
File diff suppressed because it is too large
Load Diff
1006
ffi/wgpu.h
1006
ffi/wgpu.h
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
||||
[package]
|
||||
name = "wgpu-native"
|
||||
version = "0.5.0"
|
||||
authors = [
|
||||
"Dzmitry Malyshau <kvark@mozilla.com>",
|
||||
"Joshua Groves <josh@joshgroves.com>",
|
||||
]
|
||||
edition = "2018"
|
||||
description = "WebGPU native implementation on gfx-hal"
|
||||
homepage = "https://github.com/gfx-rs/wgpu"
|
||||
repository = "https://github.com/gfx-rs/wgpu"
|
||||
keywords = ["graphics"]
|
||||
license = "MPL-2.0"
|
||||
|
||||
[lib]
|
||||
crate-type = ["lib", "cdylib", "staticlib"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
#metal-auto-capture = ["gfx-backend-metal/auto-capture"]
|
||||
vulkan-portability = ["core/gfx-backend-vulkan"]
|
||||
|
||||
[dependencies.core]
|
||||
path = "../wgpu-core"
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
|
||||
[dependencies.wgt]
|
||||
path = "../wgpu-types"
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
lazy_static = "1.1"
|
||||
parking_lot = "0.10"
|
||||
raw-window-handle = "0.3"
|
||||
libc = {version="0.2", features=[]}
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
objc = "0.2.7"
|
@ -1,48 +0,0 @@
|
||||
header = """/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */"""
|
||||
autogen_warning = """/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||
* To generate this file:
|
||||
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
|
||||
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
|
||||
* 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate wgpu-remote -o dom/webgpu/ffi/wgpu_ffi_generated.h`
|
||||
*/
|
||||
|
||||
typedef unsigned long long WGPUNonZeroU64;
|
||||
typedef unsigned long long WGPUOption_AdapterId;
|
||||
typedef unsigned long long WGPUOption_SurfaceId;
|
||||
typedef unsigned long long WGPUOption_TextureViewId;
|
||||
"""
|
||||
include_version = true
|
||||
braces = "SameLine"
|
||||
line_length = 100
|
||||
tab_width = 2
|
||||
language = "C"
|
||||
|
||||
[export]
|
||||
prefix = "WGPU"
|
||||
exclude = ["Option_AdapterId", "Option_SurfaceId", "Option_TextureViewId"]
|
||||
|
||||
[parse]
|
||||
parse_deps = true
|
||||
include = ["wgpu-core", "wgpu-types"]
|
||||
|
||||
extra_bindings = ["wgpu-core", "wgpu-types"]
|
||||
|
||||
[fn]
|
||||
|
||||
[struct]
|
||||
derive_eq = true
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
derive_helper_methods = true
|
||||
|
||||
[macro_expansion]
|
||||
bitflags = true
|
||||
|
||||
[defines]
|
||||
#"target_os = ios" = "WGPU_TARGET_IOS"
|
||||
#"target_os = macos" = "WGPU_TARGET_MACOS"
|
||||
#"unix" = "WGPU_TARGET_FAMILY_UNIX"
|
||||
#"windows" = "WGPU_TARGET_WINDOWS"
|
@ -1,132 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::GLOBAL;
|
||||
|
||||
pub use core::command::{compute_ffi::*, render_ffi::*};
|
||||
|
||||
use core::{gfx_select, id};
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_command_encoder_finish(
|
||||
encoder_id: id::CommandEncoderId,
|
||||
desc: Option<&wgt::CommandBufferDescriptor>,
|
||||
) -> id::CommandBufferId {
|
||||
let desc = &desc.cloned().unwrap_or_default();
|
||||
gfx_select!(encoder_id => GLOBAL.command_encoder_finish(encoder_id, desc))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_command_encoder_copy_buffer_to_buffer(
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
source: id::BufferId,
|
||||
source_offset: wgt::BufferAddress,
|
||||
destination: id::BufferId,
|
||||
destination_offset: wgt::BufferAddress,
|
||||
size: wgt::BufferAddress,
|
||||
) {
|
||||
gfx_select!(command_encoder_id => GLOBAL.command_encoder_copy_buffer_to_buffer(
|
||||
command_encoder_id,
|
||||
source, source_offset,
|
||||
destination,
|
||||
destination_offset,
|
||||
size))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_command_encoder_copy_buffer_to_texture(
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
source: &core::command::BufferCopyView,
|
||||
destination: &core::command::TextureCopyView,
|
||||
copy_size: wgt::Extent3d,
|
||||
) {
|
||||
gfx_select!(command_encoder_id => GLOBAL.command_encoder_copy_buffer_to_texture(
|
||||
command_encoder_id,
|
||||
source,
|
||||
destination,
|
||||
copy_size))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_command_encoder_copy_texture_to_buffer(
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
source: &core::command::TextureCopyView,
|
||||
destination: &core::command::BufferCopyView,
|
||||
copy_size: wgt::Extent3d,
|
||||
) {
|
||||
gfx_select!(command_encoder_id => GLOBAL.command_encoder_copy_texture_to_buffer(
|
||||
command_encoder_id,
|
||||
source,
|
||||
destination,
|
||||
copy_size))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_command_encoder_copy_texture_to_texture(
|
||||
command_encoder_id: id::CommandEncoderId,
|
||||
source: &core::command::TextureCopyView,
|
||||
destination: &core::command::TextureCopyView,
|
||||
copy_size: wgt::Extent3d,
|
||||
) {
|
||||
gfx_select!(command_encoder_id => GLOBAL.command_encoder_copy_texture_to_texture(
|
||||
command_encoder_id,
|
||||
source,
|
||||
destination,
|
||||
copy_size))
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because improper use may lead to memory
|
||||
/// problems. For example, a double-free may occur if the function is called
|
||||
/// twice on the same raw pointer.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
|
||||
encoder_id: id::CommandEncoderId,
|
||||
desc: &core::command::RenderPassDescriptor,
|
||||
) -> *mut core::command::RawPass {
|
||||
let pass = core::command::RawPass::new_render(encoder_id, desc);
|
||||
Box::into_raw(Box::new(pass))
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because improper use may lead to memory
|
||||
/// problems. For example, a double-free may occur if the function is called
|
||||
/// twice on the same raw pointer.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_render_pass_end_pass(pass_id: id::RenderPassId) {
|
||||
let (pass_data, encoder_id) = Box::from_raw(pass_id).finish_render();
|
||||
gfx_select!(encoder_id => GLOBAL.command_encoder_run_render_pass(encoder_id, &pass_data))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_render_pass_destroy(pass: *mut core::command::RawPass) {
|
||||
let _ = Box::from_raw(pass).into_vec();
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because improper use may lead to memory
|
||||
/// problems. For example, a double-free may occur if the function is called
|
||||
/// twice on the same raw pointer.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
|
||||
encoder_id: id::CommandEncoderId,
|
||||
_desc: Option<&core::command::ComputePassDescriptor>,
|
||||
) -> *mut core::command::RawPass {
|
||||
let pass = core::command::RawPass::new_compute(encoder_id);
|
||||
Box::into_raw(Box::new(pass))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_compute_pass_end_pass(pass_id: id::ComputePassId) {
|
||||
let (pass_data, encoder_id) = Box::from_raw(pass_id).finish_compute();
|
||||
gfx_select!(encoder_id => GLOBAL.command_encoder_run_compute_pass(encoder_id, &pass_data))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_compute_pass_destroy(pass: *mut core::command::RawPass) {
|
||||
let _ = Box::from_raw(pass).into_vec();
|
||||
}
|
@ -1,411 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::GLOBAL;
|
||||
|
||||
use core::{gfx_select, hub::Token, id};
|
||||
use wgt::{BackendBit, DeviceDescriptor, Limits};
|
||||
|
||||
use std::{marker::PhantomData, slice};
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
use objc::{msg_send, runtime::Object, sel, sel_impl};
|
||||
|
||||
pub type RequestAdapterCallback =
|
||||
unsafe extern "C" fn(id: Option<id::AdapterId>, userdata: *mut std::ffi::c_void);
|
||||
|
||||
pub fn wgpu_create_surface(raw_handle: raw_window_handle::RawWindowHandle) -> id::SurfaceId {
|
||||
use raw_window_handle::RawWindowHandle as Rwh;
|
||||
|
||||
let instance = &GLOBAL.instance;
|
||||
let surface = match raw_handle {
|
||||
#[cfg(target_os = "ios")]
|
||||
Rwh::IOS(h) => core::instance::Surface {
|
||||
#[cfg(feature = "vulkan-portability")]
|
||||
vulkan: None,
|
||||
metal: instance
|
||||
.metal
|
||||
.create_surface_from_uiview(h.ui_view, cfg!(debug_assertions)),
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
Rwh::MacOS(h) => {
|
||||
let ns_view = if h.ns_view.is_null() {
|
||||
let ns_window = h.ns_window as *mut Object;
|
||||
unsafe { msg_send![ns_window, contentView] }
|
||||
} else {
|
||||
h.ns_view
|
||||
};
|
||||
core::instance::Surface {
|
||||
#[cfg(feature = "vulkan-portability")]
|
||||
vulkan: instance
|
||||
.vulkan
|
||||
.as_ref()
|
||||
.map(|inst| inst.create_surface_from_ns_view(ns_view)),
|
||||
metal: instance
|
||||
.metal
|
||||
.create_surface_from_nsview(ns_view, cfg!(debug_assertions)),
|
||||
}
|
||||
}
|
||||
#[cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))]
|
||||
Rwh::Xlib(h) => core::instance::Surface {
|
||||
vulkan: instance
|
||||
.vulkan
|
||||
.as_ref()
|
||||
.map(|inst| inst.create_surface_from_xlib(h.display as _, h.window as _)),
|
||||
},
|
||||
#[cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))]
|
||||
Rwh::Wayland(h) => core::instance::Surface {
|
||||
vulkan: instance
|
||||
.vulkan
|
||||
.as_ref()
|
||||
.map(|inst| inst.create_surface_from_wayland(h.display, h.surface)),
|
||||
},
|
||||
#[cfg(windows)]
|
||||
Rwh::Windows(h) => core::instance::Surface {
|
||||
vulkan: instance
|
||||
.vulkan
|
||||
.as_ref()
|
||||
.map(|inst| inst.create_surface_from_hwnd(std::ptr::null_mut(), h.hwnd)),
|
||||
dx12: instance
|
||||
.dx12
|
||||
.as_ref()
|
||||
.map(|inst| inst.create_surface_from_hwnd(h.hwnd)),
|
||||
dx11: instance.dx11.create_surface_from_hwnd(h.hwnd),
|
||||
},
|
||||
_ => panic!("Unsupported window handle"),
|
||||
};
|
||||
|
||||
let mut token = Token::root();
|
||||
GLOBAL
|
||||
.surfaces
|
||||
.register_identity(PhantomData, surface, &mut token)
|
||||
}
|
||||
|
||||
#[cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_create_surface_from_xlib(
|
||||
display: *mut *const std::ffi::c_void,
|
||||
window: libc::c_ulong,
|
||||
) -> id::SurfaceId {
|
||||
use raw_window_handle::unix::XlibHandle;
|
||||
wgpu_create_surface(raw_window_handle::RawWindowHandle::Xlib(XlibHandle {
|
||||
window,
|
||||
display: display as *mut _,
|
||||
..XlibHandle::empty()
|
||||
}))
|
||||
}
|
||||
|
||||
#[cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_create_surface_from_wayland(
|
||||
surface: *mut std::ffi::c_void,
|
||||
display: *mut std::ffi::c_void,
|
||||
) -> id::SurfaceId {
|
||||
use raw_window_handle::unix::WaylandHandle;
|
||||
wgpu_create_surface(raw_window_handle::RawWindowHandle::Wayland(WaylandHandle {
|
||||
surface,
|
||||
display,
|
||||
..WaylandHandle::empty()
|
||||
}))
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "ios", target_os = "macos"))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_create_surface_from_metal_layer(
|
||||
layer: *mut std::ffi::c_void,
|
||||
) -> id::SurfaceId {
|
||||
let surface = core::instance::Surface {
|
||||
#[cfg(feature = "vulkan-portability")]
|
||||
vulkan: None, //TODO: currently requires `NSView`
|
||||
metal: GLOBAL
|
||||
.instance
|
||||
.metal
|
||||
.create_surface_from_layer(layer as *mut _, cfg!(debug_assertions)),
|
||||
};
|
||||
|
||||
GLOBAL
|
||||
.surfaces
|
||||
.register_identity(PhantomData, surface, &mut Token::root())
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_create_surface_from_windows_hwnd(
|
||||
_hinstance: *mut std::ffi::c_void,
|
||||
hwnd: *mut std::ffi::c_void,
|
||||
) -> id::SurfaceId {
|
||||
use raw_window_handle::windows::WindowsHandle;
|
||||
wgpu_create_surface(raw_window_handle::RawWindowHandle::Windows(
|
||||
raw_window_handle::windows::WindowsHandle {
|
||||
hwnd,
|
||||
..WindowsHandle::empty()
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
pub fn wgpu_enumerate_adapters(mask: BackendBit) -> Vec<id::AdapterId> {
|
||||
GLOBAL.enumerate_adapters(core::instance::AdapterInputs::Mask(mask, || PhantomData))
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as it calls an unsafe extern callback.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_request_adapter_async(
|
||||
desc: Option<&core::instance::RequestAdapterOptions>,
|
||||
mask: BackendBit,
|
||||
callback: RequestAdapterCallback,
|
||||
userdata: *mut std::ffi::c_void,
|
||||
) {
|
||||
let id = GLOBAL.pick_adapter(
|
||||
&desc.cloned().unwrap_or_default(),
|
||||
core::instance::AdapterInputs::Mask(mask, || PhantomData),
|
||||
);
|
||||
callback(id, userdata);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_adapter_request_device(
|
||||
adapter_id: id::AdapterId,
|
||||
desc: Option<&DeviceDescriptor>,
|
||||
) -> id::DeviceId {
|
||||
let desc = &desc.cloned().unwrap_or_default();
|
||||
gfx_select!(adapter_id => GLOBAL.adapter_request_device(adapter_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
pub fn adapter_get_info(adapter_id: id::AdapterId) -> core::instance::AdapterInfo {
|
||||
gfx_select!(adapter_id => GLOBAL.adapter_get_info(adapter_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_adapter_destroy(adapter_id: id::AdapterId) {
|
||||
gfx_select!(adapter_id => GLOBAL.adapter_destroy(adapter_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_get_limits(_device_id: id::DeviceId, limits: &mut Limits) {
|
||||
*limits = Limits::default(); // TODO
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_buffer(
|
||||
device_id: id::DeviceId,
|
||||
desc: &wgt::BufferDescriptor,
|
||||
) -> id::BufferId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_buffer(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer
|
||||
/// dereferenced in this function is valid.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_device_create_buffer_mapped(
|
||||
device_id: id::DeviceId,
|
||||
desc: &wgt::BufferDescriptor,
|
||||
mapped_ptr_out: *mut *mut u8,
|
||||
) -> id::BufferId {
|
||||
let (id, ptr) =
|
||||
gfx_select!(device_id => GLOBAL.device_create_buffer_mapped(device_id, desc, PhantomData));
|
||||
*mapped_ptr_out = ptr;
|
||||
id
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_buffer_destroy(buffer_id: id::BufferId) {
|
||||
gfx_select!(buffer_id => GLOBAL.buffer_destroy(buffer_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_texture(
|
||||
device_id: id::DeviceId,
|
||||
desc: &wgt::TextureDescriptor,
|
||||
) -> id::TextureId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_texture(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_texture_destroy(texture_id: id::TextureId) {
|
||||
gfx_select!(texture_id => GLOBAL.texture_destroy(texture_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_texture_create_view(
|
||||
texture_id: id::TextureId,
|
||||
desc: Option<&wgt::TextureViewDescriptor>,
|
||||
) -> id::TextureViewId {
|
||||
gfx_select!(texture_id => GLOBAL.texture_create_view(texture_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_texture_view_destroy(texture_view_id: id::TextureViewId) {
|
||||
gfx_select!(texture_view_id => GLOBAL.texture_view_destroy(texture_view_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_sampler(
|
||||
device_id: id::DeviceId,
|
||||
desc: &wgt::SamplerDescriptor,
|
||||
) -> id::SamplerId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_sampler(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_sampler_destroy(sampler_id: id::SamplerId) {
|
||||
gfx_select!(sampler_id => GLOBAL.sampler_destroy(sampler_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_bind_group_layout(
|
||||
device_id: id::DeviceId,
|
||||
desc: &core::binding_model::BindGroupLayoutDescriptor,
|
||||
) -> id::BindGroupLayoutId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_bind_group_layout(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_pipeline_layout(
|
||||
device_id: id::DeviceId,
|
||||
desc: &core::binding_model::PipelineLayoutDescriptor,
|
||||
) -> id::PipelineLayoutId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_pipeline_layout(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_bind_group(
|
||||
device_id: id::DeviceId,
|
||||
desc: &core::binding_model::BindGroupDescriptor,
|
||||
) -> id::BindGroupId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_bind_group(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_bind_group_destroy(bind_group_id: id::BindGroupId) {
|
||||
gfx_select!(bind_group_id => GLOBAL.bind_group_destroy(bind_group_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_shader_module(
|
||||
device_id: id::DeviceId,
|
||||
desc: &core::pipeline::ShaderModuleDescriptor,
|
||||
) -> id::ShaderModuleId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_shader_module(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_command_encoder(
|
||||
device_id: id::DeviceId,
|
||||
desc: Option<&wgt::CommandEncoderDescriptor>,
|
||||
) -> id::CommandEncoderId {
|
||||
let desc = &desc.cloned().unwrap_or_default();
|
||||
gfx_select!(device_id => GLOBAL.device_create_command_encoder(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_command_encoder_destroy(command_encoder_id: id::CommandEncoderId) {
|
||||
gfx_select!(command_encoder_id => GLOBAL.command_encoder_destroy(command_encoder_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_command_buffer_destroy(command_buffer_id: id::CommandBufferId) {
|
||||
gfx_select!(command_buffer_id => GLOBAL.command_buffer_destroy(command_buffer_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_get_default_queue(device_id: id::DeviceId) -> id::QueueId {
|
||||
device_id
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `command_buffers_length` elements.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_queue_submit(
|
||||
queue_id: id::QueueId,
|
||||
command_buffers: *const id::CommandBufferId,
|
||||
command_buffers_length: usize,
|
||||
) {
|
||||
let command_buffer_ids = slice::from_raw_parts(command_buffers, command_buffers_length);
|
||||
gfx_select!(queue_id => GLOBAL.queue_submit(queue_id, command_buffer_ids))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_render_pipeline(
|
||||
device_id: id::DeviceId,
|
||||
desc: &core::pipeline::RenderPipelineDescriptor,
|
||||
) -> id::RenderPipelineId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_render_pipeline(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_compute_pipeline(
|
||||
device_id: id::DeviceId,
|
||||
desc: &core::pipeline::ComputePipelineDescriptor,
|
||||
) -> id::ComputePipelineId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_compute_pipeline(device_id, desc, PhantomData))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_create_swap_chain(
|
||||
device_id: id::DeviceId,
|
||||
surface_id: id::SurfaceId,
|
||||
desc: &wgt::SwapChainDescriptor,
|
||||
) -> id::SwapChainId {
|
||||
gfx_select!(device_id => GLOBAL.device_create_swap_chain(device_id, surface_id, desc))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_poll(device_id: id::DeviceId, force_wait: bool) {
|
||||
gfx_select!(device_id => GLOBAL.device_poll(device_id, force_wait))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_device_destroy(device_id: id::DeviceId) {
|
||||
gfx_select!(device_id => GLOBAL.device_destroy(device_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_buffer_map_read_async(
|
||||
buffer_id: id::BufferId,
|
||||
start: wgt::BufferAddress,
|
||||
size: wgt::BufferAddress,
|
||||
callback: core::device::BufferMapReadCallback,
|
||||
userdata: *mut u8,
|
||||
) {
|
||||
let operation = core::resource::BufferMapOperation::Read { callback, userdata };
|
||||
|
||||
gfx_select!(buffer_id => GLOBAL.buffer_map_async(buffer_id, wgt::BufferUsage::MAP_READ, start .. start + size, operation))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_buffer_map_write_async(
|
||||
buffer_id: id::BufferId,
|
||||
start: wgt::BufferAddress,
|
||||
size: wgt::BufferAddress,
|
||||
callback: core::device::BufferMapWriteCallback,
|
||||
userdata: *mut u8,
|
||||
) {
|
||||
let operation = core::resource::BufferMapOperation::Write { callback, userdata };
|
||||
|
||||
gfx_select!(buffer_id => GLOBAL.buffer_map_async(buffer_id, wgt::BufferUsage::MAP_WRITE, start .. start + size, operation))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_buffer_unmap(buffer_id: id::BufferId) {
|
||||
gfx_select!(buffer_id => GLOBAL.buffer_unmap(buffer_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_swap_chain_get_next_texture(
|
||||
swap_chain_id: id::SwapChainId,
|
||||
) -> core::swap_chain::SwapChainOutput {
|
||||
gfx_select!(swap_chain_id => GLOBAL.swap_chain_get_next_texture(swap_chain_id, PhantomData))
|
||||
.unwrap_or(core::swap_chain::SwapChainOutput { view_id: None })
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_swap_chain_present(swap_chain_id: id::SwapChainId) {
|
||||
gfx_select!(swap_chain_id => GLOBAL.swap_chain_present(swap_chain_id))
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
mod command;
|
||||
mod device;
|
||||
|
||||
pub use self::command::*;
|
||||
pub use self::device::*;
|
||||
|
||||
type Global = core::hub::Global<core::hub::IdentityManagerFactory>;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref GLOBAL: Arc<Global> = Arc::new(Global::new("wgpu", core::hub::IdentityManagerFactory));
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
[package]
|
||||
name = "wgpu-remote"
|
||||
version = "0.1.0"
|
||||
authors = [
|
||||
"Dzmitry Malyshau <kvark@mozilla.com>",
|
||||
"Joshua Groves <josh@joshgroves.com>",
|
||||
]
|
||||
edition = "2018"
|
||||
license = "MPL-2.0"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
# Enabling these targets makes our CI bots try to build them and fail atm
|
||||
#crate-type = ["lib", "cdylib", "staticlib"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
[dependencies.core]
|
||||
path = "../wgpu-core"
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
features = ["serde"]
|
||||
|
||||
[dependencies.wgt]
|
||||
path = "../wgpu-types"
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
features = ["serde"]
|
||||
|
||||
[dependencies]
|
||||
log = "0.4"
|
||||
parking_lot = { version = "0.10" }
|
@ -1,53 +0,0 @@
|
||||
header = """/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */"""
|
||||
autogen_warning = """/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||
* To generate this file:
|
||||
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
|
||||
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
|
||||
* 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate wgpu-remote -o dom/webgpu/ffi/wgpu_ffi_generated.h`
|
||||
*/
|
||||
|
||||
typedef uint64_t WGPUNonZeroU64;
|
||||
typedef uint64_t WGPUOption_AdapterId;
|
||||
typedef uint64_t WGPUOption_SurfaceId;
|
||||
typedef uint64_t WGPUOption_TextureViewId;
|
||||
"""
|
||||
include_version = true
|
||||
braces = "SameLine"
|
||||
line_length = 100
|
||||
tab_width = 2
|
||||
language = "C"
|
||||
style = "tag"
|
||||
|
||||
[export]
|
||||
prefix = "WGPU"
|
||||
exclude = ["Option_AdapterId", "Option_SurfaceId", "Option_TextureViewId"]
|
||||
|
||||
[parse]
|
||||
parse_deps = true
|
||||
include = ["wgpu-core", "wgpu-types"]
|
||||
|
||||
extra_bindings = ["wgpu-core", "wgpu-types"]
|
||||
|
||||
[fn]
|
||||
prefix = "WGPU_INLINE"
|
||||
postfix = "WGPU_FUNC"
|
||||
args = "Vertical"
|
||||
rename_args = "GeckoCase"
|
||||
|
||||
[struct]
|
||||
derive_eq = true
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
derive_helper_methods = true
|
||||
add_sentinel = true
|
||||
|
||||
[macro_expansion]
|
||||
bitflags = true
|
||||
|
||||
[defines]
|
||||
"target_os = windows" = "XP_WIN"
|
||||
"target_os = macos" = "XP_MACOSX"
|
||||
"target_os = android" = "ANDROID"
|
@ -1,202 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use core::id;
|
||||
|
||||
pub type FactoryParam = *mut std::ffi::c_void;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct IdentityRecycler<I> {
|
||||
fun: extern "C" fn(I, FactoryParam),
|
||||
param: FactoryParam,
|
||||
kind: &'static str,
|
||||
}
|
||||
|
||||
impl<I: id::TypedId + Clone + std::fmt::Debug> core::hub::IdentityHandler<I>
|
||||
for IdentityRecycler<I>
|
||||
{
|
||||
type Input = I;
|
||||
fn process(&self, id: I, _backend: wgt::Backend) -> I {
|
||||
log::debug!("process {} {:?}", self.kind, id);
|
||||
//debug_assert_eq!(id.unzip().2, backend);
|
||||
id
|
||||
}
|
||||
fn free(&self, id: I) {
|
||||
log::debug!("free {} {:?}", self.kind, id);
|
||||
(self.fun)(id, self.param);
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct IdentityRecyclerFactory {
|
||||
param: FactoryParam,
|
||||
free_adapter: extern "C" fn(id::AdapterId, FactoryParam),
|
||||
free_device: extern "C" fn(id::DeviceId, FactoryParam),
|
||||
free_swap_chain: extern "C" fn(id::SwapChainId, FactoryParam),
|
||||
free_pipeline_layout: extern "C" fn(id::PipelineLayoutId, FactoryParam),
|
||||
free_shader_module: extern "C" fn(id::ShaderModuleId, FactoryParam),
|
||||
free_bind_group_layout: extern "C" fn(id::BindGroupLayoutId, FactoryParam),
|
||||
free_bind_group: extern "C" fn(id::BindGroupId, FactoryParam),
|
||||
free_command_buffer: extern "C" fn(id::CommandBufferId, FactoryParam),
|
||||
free_render_pipeline: extern "C" fn(id::RenderPipelineId, FactoryParam),
|
||||
free_compute_pipeline: extern "C" fn(id::ComputePipelineId, FactoryParam),
|
||||
free_buffer: extern "C" fn(id::BufferId, FactoryParam),
|
||||
free_texture: extern "C" fn(id::TextureId, FactoryParam),
|
||||
free_texture_view: extern "C" fn(id::TextureViewId, FactoryParam),
|
||||
free_sampler: extern "C" fn(id::SamplerId, FactoryParam),
|
||||
free_surface: extern "C" fn(id::SurfaceId, FactoryParam),
|
||||
}
|
||||
|
||||
impl core::hub::IdentityHandlerFactory<id::AdapterId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::AdapterId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_adapter,
|
||||
param: self.param,
|
||||
kind: "adapter",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::DeviceId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::DeviceId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_device,
|
||||
param: self.param,
|
||||
kind: "device",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::SwapChainId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::SwapChainId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_swap_chain,
|
||||
param: self.param,
|
||||
kind: "swap_chain",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::PipelineLayoutId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::PipelineLayoutId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_pipeline_layout,
|
||||
param: self.param,
|
||||
kind: "pipeline_layout",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::ShaderModuleId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::ShaderModuleId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_shader_module,
|
||||
param: self.param,
|
||||
kind: "shader_module",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::BindGroupLayoutId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::BindGroupLayoutId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_bind_group_layout,
|
||||
param: self.param,
|
||||
kind: "bind_group_layout",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::BindGroupId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::BindGroupId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_bind_group,
|
||||
param: self.param,
|
||||
kind: "bind_group",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::CommandBufferId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::CommandBufferId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_command_buffer,
|
||||
param: self.param,
|
||||
kind: "command_buffer",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::RenderPipelineId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::RenderPipelineId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_render_pipeline,
|
||||
param: self.param,
|
||||
kind: "render_pipeline",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::ComputePipelineId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::ComputePipelineId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_compute_pipeline,
|
||||
param: self.param,
|
||||
kind: "compute_pipeline",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::BufferId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::BufferId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_buffer,
|
||||
param: self.param,
|
||||
kind: "buffer",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::TextureId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::TextureId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_texture,
|
||||
param: self.param,
|
||||
kind: "texture",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::TextureViewId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::TextureViewId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_texture_view,
|
||||
param: self.param,
|
||||
kind: "texture_view",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::SamplerId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::SamplerId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_sampler,
|
||||
param: self.param,
|
||||
kind: "sampler",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl core::hub::IdentityHandlerFactory<id::SurfaceId> for IdentityRecyclerFactory {
|
||||
type Filter = IdentityRecycler<id::SurfaceId>;
|
||||
fn spawn(&self, _min_index: u32) -> Self::Filter {
|
||||
IdentityRecycler {
|
||||
fun: self.free_surface,
|
||||
param: self.param,
|
||||
kind: "surface",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl core::hub::GlobalIdentityHandlerFactory for IdentityRecyclerFactory {}
|
@ -1,446 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use core::{hub::IdentityManager, id};
|
||||
|
||||
use wgt::Backend;
|
||||
|
||||
pub use core::command::{compute_ffi::*, render_ffi::*};
|
||||
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use std::{ptr, slice};
|
||||
|
||||
pub mod identity;
|
||||
pub mod server;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct IdentityHub {
|
||||
adapters: IdentityManager,
|
||||
devices: IdentityManager,
|
||||
buffers: IdentityManager,
|
||||
command_buffers: IdentityManager,
|
||||
bind_group_layouts: IdentityManager,
|
||||
pipeline_layouts: IdentityManager,
|
||||
bind_groups: IdentityManager,
|
||||
shader_modules: IdentityManager,
|
||||
compute_pipelines: IdentityManager,
|
||||
render_pipelines: IdentityManager,
|
||||
textures: IdentityManager,
|
||||
texture_views: IdentityManager,
|
||||
samplers: IdentityManager,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct Identities {
|
||||
surfaces: IdentityManager,
|
||||
vulkan: IdentityHub,
|
||||
#[cfg(any(target_os = "ios", target_os = "macos"))]
|
||||
metal: IdentityHub,
|
||||
#[cfg(windows)]
|
||||
dx12: IdentityHub,
|
||||
}
|
||||
|
||||
impl Identities {
|
||||
fn select(&mut self, backend: Backend) -> &mut IdentityHub {
|
||||
match backend {
|
||||
Backend::Vulkan => &mut self.vulkan,
|
||||
#[cfg(any(target_os = "ios", target_os = "macos"))]
|
||||
Backend::Metal => &mut self.metal,
|
||||
#[cfg(windows)]
|
||||
Backend::Dx12 => &mut self.dx12,
|
||||
_ => panic!("Unexpected backend: {:?}", backend),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Client {
|
||||
identities: Mutex<Identities>,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct Infrastructure {
|
||||
pub client: *mut Client,
|
||||
pub error: *const u8,
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_new() -> Infrastructure {
|
||||
log::info!("Initializing WGPU client");
|
||||
let client = Box::new(Client {
|
||||
identities: Mutex::new(Identities::default()),
|
||||
});
|
||||
Infrastructure {
|
||||
client: Box::into_raw(client),
|
||||
error: ptr::null(),
|
||||
}
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because improper use may lead to memory
|
||||
/// problems. For example, a double-free may occur if the function is called
|
||||
/// twice on the same raw pointer.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_client_delete(client: *mut Client) {
|
||||
log::info!("Terminating WGPU client");
|
||||
let _client = Box::from_raw(client);
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `id_length` elements.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_client_make_adapter_ids(
|
||||
client: &Client,
|
||||
ids: *mut id::AdapterId,
|
||||
id_length: usize,
|
||||
) -> usize {
|
||||
let mut identities = client.identities.lock();
|
||||
assert_ne!(id_length, 0);
|
||||
let mut ids = slice::from_raw_parts_mut(ids, id_length).iter_mut();
|
||||
|
||||
*ids.next().unwrap() = identities.vulkan.adapters.alloc(Backend::Vulkan);
|
||||
|
||||
#[cfg(any(target_os = "ios", target_os = "macos"))]
|
||||
{
|
||||
*ids.next().unwrap() = identities.metal.adapters.alloc(Backend::Metal);
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
*ids.next().unwrap() = identities.dx12.adapters.alloc(Backend::Dx12);
|
||||
}
|
||||
|
||||
id_length - ids.len()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_adapter_id(client: &Client, id: id::AdapterId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.adapters
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_device_id(
|
||||
client: &Client,
|
||||
adapter_id: id::AdapterId,
|
||||
) -> id::DeviceId {
|
||||
let backend = adapter_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.devices
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_device_id(client: &Client, id: id::DeviceId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.devices
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_buffer_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::BufferId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.buffers
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_buffer_id(client: &Client, id: id::BufferId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.buffers
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_texture_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::TextureId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.textures
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_texture_id(client: &Client, id: id::TextureId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.textures
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_texture_view_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::TextureViewId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.texture_views
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_texture_view_id(client: &Client, id: id::TextureViewId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.texture_views
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_sampler_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::SamplerId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.samplers
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_sampler_id(client: &Client, id: id::SamplerId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.samplers
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_encoder_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::CommandEncoderId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.command_buffers
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_encoder_id(client: &Client, id: id::CommandEncoderId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.command_buffers
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
|
||||
encoder_id: id::CommandEncoderId,
|
||||
_desc: Option<&core::command::ComputePassDescriptor>,
|
||||
) -> core::command::RawPass {
|
||||
core::command::RawPass::new_compute(encoder_id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_compute_pass_destroy(pass: core::command::RawPass) {
|
||||
let _ = pass.into_vec();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
|
||||
encoder_id: id::CommandEncoderId,
|
||||
desc: &core::command::RenderPassDescriptor,
|
||||
) -> core::command::RawPass {
|
||||
core::command::RawPass::new_render(encoder_id, desc)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_render_pass_destroy(pass: core::command::RawPass) {
|
||||
let _ = pass.into_vec();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_bind_group_layout_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::BindGroupLayoutId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.bind_group_layouts
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_bind_group_layout_id(
|
||||
client: &Client,
|
||||
id: id::BindGroupLayoutId,
|
||||
) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.bind_group_layouts
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_pipeline_layout_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::PipelineLayoutId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.pipeline_layouts
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_pipeline_layout_id(client: &Client, id: id::PipelineLayoutId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.pipeline_layouts
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_bind_group_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::BindGroupId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.bind_groups
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_bind_group_id(client: &Client, id: id::BindGroupId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.bind_groups
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_shader_module_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::ShaderModuleId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.shader_modules
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_shader_module_id(client: &Client, id: id::ShaderModuleId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.shader_modules
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_compute_pipeline_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::ComputePipelineId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.compute_pipelines
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_compute_pipeline_id(client: &Client, id: id::ComputePipelineId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.compute_pipelines
|
||||
.free(id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_make_render_pipeline_id(
|
||||
client: &Client,
|
||||
device_id: id::DeviceId,
|
||||
) -> id::RenderPipelineId {
|
||||
let backend = device_id.backend();
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(backend)
|
||||
.render_pipelines
|
||||
.alloc(backend)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_kill_render_pipeline_id(client: &Client, id: id::RenderPipelineId) {
|
||||
client
|
||||
.identities
|
||||
.lock()
|
||||
.select(id.backend())
|
||||
.render_pipelines
|
||||
.free(id)
|
||||
}
|
@ -1,416 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::identity::IdentityRecyclerFactory;
|
||||
|
||||
use core::{gfx_select, id};
|
||||
|
||||
use std::slice;
|
||||
|
||||
pub type Global = core::hub::Global<IdentityRecyclerFactory>;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_new(factory: IdentityRecyclerFactory) -> *mut Global {
|
||||
log::info!("Initializing WGPU server");
|
||||
Box::into_raw(Box::new(Global::new("wgpu", factory)))
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because improper use may lead to memory
|
||||
/// problems. For example, a double-free may occur if the function is called
|
||||
/// twice on the same raw pointer.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_delete(global: *mut Global) {
|
||||
log::info!("Terminating WGPU server");
|
||||
Box::from_raw(global).delete();
|
||||
log::info!("\t...done");
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_poll_all_devices(global: &Global, force_wait: bool) {
|
||||
global.poll_all_devices(force_wait);
|
||||
}
|
||||
|
||||
/// Request an adapter according to the specified options.
|
||||
/// Provide the list of IDs to pick from.
|
||||
///
|
||||
/// Returns the index in this list, or -1 if unable to pick.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `id_length` elements.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_instance_request_adapter(
|
||||
global: &Global,
|
||||
desc: &core::instance::RequestAdapterOptions,
|
||||
ids: *const id::AdapterId,
|
||||
id_length: usize,
|
||||
) -> i8 {
|
||||
let ids = slice::from_raw_parts(ids, id_length);
|
||||
match global.pick_adapter(
|
||||
desc,
|
||||
core::instance::AdapterInputs::IdSet(ids, |i| i.backend()),
|
||||
) {
|
||||
Some(id) => ids.iter().position(|&i| i == id).unwrap() as i8,
|
||||
None => -1,
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_adapter_request_device(
|
||||
global: &Global,
|
||||
self_id: id::AdapterId,
|
||||
desc: &wgt::DeviceDescriptor,
|
||||
new_id: id::DeviceId,
|
||||
) {
|
||||
gfx_select!(self_id => global.adapter_request_device(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_adapter_destroy(global: &Global, adapter_id: id::AdapterId) {
|
||||
gfx_select!(adapter_id => global.adapter_destroy(adapter_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_destroy(global: &Global, self_id: id::DeviceId) {
|
||||
gfx_select!(self_id => global.device_destroy(self_id))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_buffer(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &wgt::BufferDescriptor,
|
||||
new_id: id::BufferId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_buffer(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `size` elements.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_device_set_buffer_sub_data(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
buffer_id: id::BufferId,
|
||||
offset: wgt::BufferAddress,
|
||||
data: *const u8,
|
||||
size: wgt::BufferAddress,
|
||||
) {
|
||||
let slice = slice::from_raw_parts(data, size as usize);
|
||||
gfx_select!(self_id => global.device_set_buffer_sub_data(self_id, buffer_id, offset, slice));
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `size` elements.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_buffer_map_read(
|
||||
global: &Global,
|
||||
buffer_id: id::BufferId,
|
||||
start: wgt::BufferAddress,
|
||||
size: wgt::BufferAddress,
|
||||
callback: core::device::BufferMapReadCallback,
|
||||
userdata: *mut u8,
|
||||
) {
|
||||
let operation = core::resource::BufferMapOperation::Read { callback, userdata };
|
||||
|
||||
gfx_select!(buffer_id => global.buffer_map_async(
|
||||
buffer_id,
|
||||
wgt::BufferUsage::MAP_READ,
|
||||
start .. start + size,
|
||||
operation
|
||||
));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_buffer_unmap(global: &Global, buffer_id: id::BufferId) {
|
||||
gfx_select!(buffer_id => global.buffer_unmap(buffer_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_buffer_destroy(global: &Global, self_id: id::BufferId) {
|
||||
gfx_select!(self_id => global.buffer_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_encoder(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &wgt::CommandEncoderDescriptor,
|
||||
new_id: id::CommandEncoderId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_command_encoder(self_id, &desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_encoder_finish(
|
||||
global: &Global,
|
||||
self_id: id::CommandEncoderId,
|
||||
desc: &wgt::CommandBufferDescriptor,
|
||||
) {
|
||||
gfx_select!(self_id => global.command_encoder_finish(self_id, desc));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_encoder_destroy(global: &Global, self_id: id::CommandEncoderId) {
|
||||
gfx_select!(self_id => global.command_encoder_destroy(self_id));
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `byte_length` elements.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_command_buffer_destroy(
|
||||
global: &Global,
|
||||
self_id: id::CommandBufferId,
|
||||
) {
|
||||
gfx_select!(self_id => global.command_buffer_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_encoder_copy_buffer_to_buffer(
|
||||
global: &Global,
|
||||
self_id: id::CommandEncoderId,
|
||||
source_id: id::BufferId,
|
||||
source_offset: wgt::BufferAddress,
|
||||
destination_id: id::BufferId,
|
||||
destination_offset: wgt::BufferAddress,
|
||||
size: wgt::BufferAddress,
|
||||
) {
|
||||
gfx_select!(self_id => global.command_encoder_copy_buffer_to_buffer(self_id, source_id, source_offset, destination_id, destination_offset, size));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_encoder_copy_texture_to_buffer(
|
||||
global: &Global,
|
||||
self_id: id::CommandEncoderId,
|
||||
source: &core::command::TextureCopyView,
|
||||
destination: &core::command::BufferCopyView,
|
||||
size: wgt::Extent3d,
|
||||
) {
|
||||
gfx_select!(self_id => global.command_encoder_copy_texture_to_buffer(self_id, source, destination, size));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_encoder_copy_buffer_to_texture(
|
||||
global: &Global,
|
||||
self_id: id::CommandEncoderId,
|
||||
source: &core::command::BufferCopyView,
|
||||
destination: &core::command::TextureCopyView,
|
||||
size: wgt::Extent3d,
|
||||
) {
|
||||
gfx_select!(self_id => global.command_encoder_copy_buffer_to_texture(self_id, source, destination, size));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_encoder_copy_texture_to_texture(
|
||||
global: &Global,
|
||||
self_id: id::CommandEncoderId,
|
||||
source: &core::command::TextureCopyView,
|
||||
destination: &core::command::TextureCopyView,
|
||||
size: wgt::Extent3d,
|
||||
) {
|
||||
gfx_select!(self_id => global.command_encoder_copy_texture_to_texture(self_id, source, destination, size));
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointers are
|
||||
/// valid for `color_attachments_length` and `command_length` elements,
|
||||
/// respectively.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_encode_compute_pass(
|
||||
global: &Global,
|
||||
self_id: id::CommandEncoderId,
|
||||
bytes: *const u8,
|
||||
byte_length: usize,
|
||||
) {
|
||||
let raw_data = slice::from_raw_parts(bytes, byte_length);
|
||||
gfx_select!(self_id => global.command_encoder_run_compute_pass(self_id, raw_data));
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointers are
|
||||
/// valid for `color_attachments_length` and `command_length` elements,
|
||||
/// respectively.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_encode_render_pass(
|
||||
global: &Global,
|
||||
self_id: id::CommandEncoderId,
|
||||
commands: *const u8,
|
||||
command_length: usize,
|
||||
) {
|
||||
let raw_pass = slice::from_raw_parts(commands, command_length);
|
||||
gfx_select!(self_id => global.command_encoder_run_render_pass(self_id, raw_pass));
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `command_buffer_id_length` elements.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wgpu_server_queue_submit(
|
||||
global: &Global,
|
||||
self_id: id::QueueId,
|
||||
command_buffer_ids: *const id::CommandBufferId,
|
||||
command_buffer_id_length: usize,
|
||||
) {
|
||||
let command_buffers = slice::from_raw_parts(command_buffer_ids, command_buffer_id_length);
|
||||
gfx_select!(self_id => global.queue_submit(self_id, command_buffers));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_bind_group_layout(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &core::binding_model::BindGroupLayoutDescriptor,
|
||||
new_id: id::BindGroupLayoutId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_bind_group_layout(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_bind_group_layout_destroy(
|
||||
global: &Global,
|
||||
self_id: id::BindGroupLayoutId,
|
||||
) {
|
||||
gfx_select!(self_id => global.bind_group_layout_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_pipeline_layout(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &core::binding_model::PipelineLayoutDescriptor,
|
||||
new_id: id::PipelineLayoutId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_pipeline_layout(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_pipeline_layout_destroy(
|
||||
global: &Global,
|
||||
self_id: id::PipelineLayoutId,
|
||||
) {
|
||||
gfx_select!(self_id => global.pipeline_layout_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_bind_group(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &core::binding_model::BindGroupDescriptor,
|
||||
new_id: id::BindGroupId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_bind_group(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_bind_group_destroy(global: &Global, self_id: id::BindGroupId) {
|
||||
gfx_select!(self_id => global.bind_group_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_shader_module(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &core::pipeline::ShaderModuleDescriptor,
|
||||
new_id: id::ShaderModuleId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_shader_module(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_shader_module_destroy(global: &Global, self_id: id::ShaderModuleId) {
|
||||
gfx_select!(self_id => global.shader_module_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_compute_pipeline(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &core::pipeline::ComputePipelineDescriptor,
|
||||
new_id: id::ComputePipelineId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_compute_pipeline(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_compute_pipeline_destroy(
|
||||
global: &Global,
|
||||
self_id: id::ComputePipelineId,
|
||||
) {
|
||||
gfx_select!(self_id => global.compute_pipeline_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_render_pipeline(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &core::pipeline::RenderPipelineDescriptor,
|
||||
new_id: id::RenderPipelineId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_render_pipeline(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_render_pipeline_destroy(
|
||||
global: &Global,
|
||||
self_id: id::RenderPipelineId,
|
||||
) {
|
||||
gfx_select!(self_id => global.render_pipeline_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_texture(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &wgt::TextureDescriptor,
|
||||
new_id: id::TextureId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_texture(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_texture_create_view(
|
||||
global: &Global,
|
||||
self_id: id::TextureId,
|
||||
desc: Option<&wgt::TextureViewDescriptor>,
|
||||
new_id: id::TextureViewId,
|
||||
) {
|
||||
gfx_select!(self_id => global.texture_create_view(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_texture_destroy(global: &Global, self_id: id::TextureId) {
|
||||
gfx_select!(self_id => global.texture_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_texture_view_destroy(global: &Global, self_id: id::TextureViewId) {
|
||||
gfx_select!(self_id => global.texture_view_destroy(self_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_device_create_sampler(
|
||||
global: &Global,
|
||||
self_id: id::DeviceId,
|
||||
desc: &wgt::SamplerDescriptor,
|
||||
new_id: id::SamplerId,
|
||||
) {
|
||||
gfx_select!(self_id => global.device_create_sampler(self_id, desc, new_id));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_server_sampler_destroy(global: &Global, self_id: id::SamplerId) {
|
||||
gfx_select!(self_id => global.sampler_destroy(self_id));
|
||||
}
|
Loading…
Reference in New Issue
Block a user