Skip to content

Commit

Permalink
Remove wgpu-bindings in favor of configuration scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Apr 30, 2019
1 parent 0011d9f commit 61fca00
Show file tree
Hide file tree
Showing 22 changed files with 245 additions and 525 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.vscode
.vs
build
ffi/dawn*.h
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ before_install:

script:
- cargo test
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then (brew update && brew upgrade cmake && brew install glfw3 && make ci-examples); fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then (brew update && brew upgrade cmake && brew install glfw3 && make ffi-examples); fi
100 changes: 0 additions & 100 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[workspace]
members = [
"wgpu-native",
"wgpu-bindings",
"wgpu-remote",
"wgpu-rs",
"examples",
Expand Down
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ else
endif


.PHONY: all check test doc clear lib-native lib-remote lib-rust ci-examples examples-rust examples-gfx gfx
.PHONY: all check test doc clear lib-native lib-remote lib-rust examples-rust examples-gfx gfx ffi-examples

all: ci-examples examples-rust examples-gfx
all: examples-rust examples-gfx ffi-examples

check:
cargo check --all
Expand All @@ -56,19 +56,23 @@ lib-remote: Cargo.lock wgpu-remote/Cargo.toml $(wildcard wgpu-native/**/*.rs wgp
lib-rust: Cargo.lock wgpu-rs/Cargo.toml $(wildcard wgpu-rs/**/*.rs)
cargo build --manifest-path wgpu-rs/Cargo.toml --features $(FEATURE_RUST)

ffi/wgpu.h: wgpu-native/cbindgen.toml $(wildcard wgpu-native/**/*.rs)
cbindgen wgpu-native >ffi/wgpu.h

ffi/wgpu-remote.h: wgpu-remote/cbindgen.toml $(wildcard wgpu-native/**/*.rs wgpu-remote/**/*.rs)
cbindgen wgpu-remote >ffi/wgpu-remote.h

wgpu-bindings/*.h: Cargo.lock $(wildcard wgpu-bindings/src/*.rs) lib-native lib-remote
cargo +nightly run --manifest-path wgpu-bindings/Cargo.toml

ci-examples:
cargo build --manifest-path wgpu-native/Cargo.toml --features=local,$(FEATURE_NATIVE)
cargo build --manifest-path wgpu-remote/Cargo.toml --features=$(FEATURE_RUST)
ffi-examples: lib-native lib-remote ffi/wgpu.h ffi/wgpu-remote.h
cd examples/hello_triangle_c && mkdir -p build && cd build && cmake .. && make
cd examples/hello_remote_c && mkdir -p build && cd build && cmake .. && make

examples-rust: lib-rust examples/Cargo.toml $(wildcard wgpu-native/**/*.rs)
examples-rust: examples/Cargo.toml $(wildcard wgpu-native/**/*.rs wgpu-rs/**/*.rs)
cargo build --manifest-path examples/Cargo.toml --features $(FEATURE_RUST)

examples-gfx: lib-rust gfx-examples/Cargo.toml $(wildcard gfx-examples/*.rs)
examples-gfx: examples-rust gfx-examples/Cargo.toml $(wildcard gfx-examples/*.rs)
cargo build --manifest-path gfx-examples/Cargo.toml --features $(FEATURE_RUST)

gfx:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ This is an experimental [WebGPU](https://www.w3.org/community/gpu/) implementati

The implementation consists of the following parts:
- `wgpu-native` - the native implementation of WebGPU as a C API library
- `wgpu-bindings` - automatic generator of actual C headers
- `wgpu-remote` - remoting layer to work with WebGPU across the process boundary
- `wgpu-rs` - idiomatic Rust wrapper of the native library

Expand Down
5 changes: 2 additions & 3 deletions examples/hello_remote_c/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "./../../wgpu-bindings/wgpu-native.h"
#include "./../../wgpu-bindings/wgpu-remote.h"
#include "./../../ffi/wgpu-remote.h"
#include <stdio.h>

int main() {
Expand All @@ -12,7 +11,7 @@ int main() {

//TODO: do something meaningful

wgpu_terminate(infra.client);
wgpu_client_terminate(infra.client);

return 0;
}
2 changes: 1 addition & 1 deletion examples/hello_triangle_c/main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "./../../wgpu-bindings/wgpu.h"
#include "./../../ffi/wgpu.h"
#include <stdio.h>

#define WGPU_TARGET_MACOS 1
Expand Down
67 changes: 67 additions & 0 deletions ffi/wgpu-remote.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@


/* Generated with cbindgen:0.8.3 */

#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef enum {
WGPUPowerPreference_Default = 0,
WGPUPowerPreference_LowPower = 1,
WGPUPowerPreference_HighPerformance = 2,
} WGPUPowerPreference;

typedef struct WGPUClient WGPUClient;

typedef struct WGPUServer WGPUServer;

typedef struct WGPUTrackPermit WGPUTrackPermit;

typedef uint32_t WGPUIndex;

typedef uint32_t WGPUEpoch;

typedef struct {
WGPUIndex _0;
WGPUEpoch _1;
} WGPUId;

typedef WGPUId WGPUDeviceId;

typedef WGPUId WGPUAdapterId;

typedef struct {
bool anisotropic_filtering;
} WGPUExtensions;

typedef struct {
WGPUExtensions extensions;
} WGPUDeviceDescriptor;

typedef struct {
WGPUPowerPreference power_preference;
} WGPUAdapterDescriptor;

typedef struct {
WGPUClient *client;
WGPUServer *server;
const uint8_t *error;
} WGPUInfrastructure;





WGPUDeviceId wgpu_client_adapter_create_device(const WGPUClient *client,
WGPUAdapterId adapter_id,
const WGPUDeviceDescriptor *desc);

WGPUAdapterId wgpu_client_get_adapter(const WGPUClient *client, const WGPUAdapterDescriptor *desc);

void wgpu_client_terminate(WGPUClient *client);

WGPUInfrastructure wgpu_initialize(void);

void wgpu_server_process(const WGPUServer *server);
Loading

0 comments on commit 61fca00

Please sign in to comment.