From 0296e82faba510aaceba3dd10b773998ba931c7e Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 20 Aug 2019 14:59:17 -0400 Subject: [PATCH] Fix cbindgen flags --- ffi/wgpu.h | 29 +++++++++++++++++++++-------- wgpu-native/cbindgen.toml | 13 +++++++------ wgpu-remote/cbindgen.toml | 5 +---- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/ffi/wgpu.h b/ffi/wgpu.h index 342616f090..d896787c0f 100644 --- a/ffi/wgpu.h +++ b/ffi/wgpu.h @@ -1,4 +1,6 @@ #define WGPU_LOCAL +struct WGPUWindow; + /* Generated with cbindgen:0.9.0 */ @@ -381,7 +383,17 @@ typedef WGPUGenericId_ComputePipelineHandle WGPUComputePipelineId; typedef WGPUId WGPUGenericId_InstanceHandle; +typedef WGPUId WGPUGenericId_SurfaceHandle; + +typedef WGPUGenericId_SurfaceHandle WGPUSurfaceId; + +#if !defined(WGPU_BACKEND_GL) typedef WGPUGenericId_InstanceHandle WGPUInstanceId; +#endif + +#if defined(WGPU_BACKEND_GL) +typedef WGPUSurfaceId WGPUInstanceId; +#endif typedef WGPUId WGPUGenericId_BindGroupLayoutHandle; @@ -607,10 +619,6 @@ typedef struct { WGPUU32Array code; } WGPUShaderModuleDescriptor; -typedef WGPUId WGPUGenericId_SurfaceHandle; - -typedef WGPUGenericId_SurfaceHandle WGPUSurfaceId; - typedef WGPUSurfaceId WGPUSwapChainId; typedef uint32_t WGPUTextureUsage; @@ -744,7 +752,7 @@ void wgpu_compute_pass_set_bind_group(WGPUComputePassId pass_id, void wgpu_compute_pass_set_pipeline(WGPUComputePassId pass_id, WGPUComputePipelineId pipeline_id); -#if defined(WGPU_LOCAL) +#if (defined(WGPU_LOCAL) && !defined(WGPU_BACKEND_GL)) WGPUInstanceId wgpu_create_instance(void); #endif @@ -817,18 +825,23 @@ WGPUQueueId wgpu_device_get_queue(WGPUDeviceId device_id); void wgpu_device_poll(WGPUDeviceId device_id, bool force_wait); -#if defined(WGPU_LOCAL) +#if (defined(WGPU_LOCAL) && !defined(WGPU_BACKEND_GL)) WGPUSurfaceId wgpu_instance_create_surface_from_macos_layer(WGPUInstanceId instance_id, void *layer); #endif -#if defined(WGPU_LOCAL) +#if (defined(WGPU_LOCAL) && !defined(WGPU_BACKEND_GL)) WGPUSurfaceId wgpu_instance_create_surface_from_windows_hwnd(WGPUInstanceId instance_id, void *hinstance, void *hwnd); #endif -#if defined(WGPU_LOCAL) +#if (defined(WGPU_LOCAL) && defined(WGPU_WINIT) && !defined(WGPU_GLUTIN)) +WGPUSurfaceId wgpu_instance_create_surface_from_winit(WGPUInstanceId instance_id, + const WGPUWindow *window); +#endif + +#if (defined(WGPU_LOCAL) && !defined(WGPU_BACKEND_GL)) WGPUSurfaceId wgpu_instance_create_surface_from_xlib(WGPUInstanceId instance_id, const void **display, uint64_t window); diff --git a/wgpu-native/cbindgen.toml b/wgpu-native/cbindgen.toml index 42a9acb0e6..738aa3acf9 100644 --- a/wgpu-native/cbindgen.toml +++ b/wgpu-native/cbindgen.toml @@ -1,4 +1,7 @@ -header = "#define WGPU_LOCAL" +header = """ +#define WGPU_LOCAL +struct WGPUWindow; +""" include_version = true braces = "SameLine" line_length = 100 @@ -13,10 +16,6 @@ exclude = ["BufferMapResult"] [parse] parse_deps = false -[parse.expand] -crates = ["wgpu-native"] -features = ["local"] - [fn] [struct] @@ -30,6 +29,8 @@ derive_helper_methods = true bitflags = true [defines] -"feature = window-winit" = "WGPU_WINDOW_WINIT" "feature = local" = "WGPU_LOCAL" "feature = remote" = "WGPU_REMOTE" +"feature = gfx-backend-gl" = "WGPU_BACKEND_GL" +"feature = winit" = "WGPU_WINIT" +"feature = glutin" = "WGPU_GLUTIN" diff --git a/wgpu-remote/cbindgen.toml b/wgpu-remote/cbindgen.toml index ead37a0897..736de64dac 100644 --- a/wgpu-remote/cbindgen.toml +++ b/wgpu-remote/cbindgen.toml @@ -11,10 +11,7 @@ exclude = ["BufferMapResult"] [parse] parse_deps = true -include = ["wgpu_native"] - -[parse.expand] -crates = ["wgpu-native"] +include = ["wgpu-native"] [fn]