Skip to content

Commit 33859ff

Browse files
bors[bot]kvark
andauthored
Merge #17
17: Update for wgpu-core r=kvark a=kvark Depends on gfx-rs/wgpu#619 Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2 parents e5b4a60 + fdf8d47 commit 33859ff

7 files changed

Lines changed: 115 additions & 139 deletions

File tree

Cargo.lock

Lines changed: 46 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ crate-type = ["lib", "cdylib", "staticlib"]
1818
[features]
1919
default = []
2020
#metal-auto-capture = ["gfx-backend-metal/auto-capture"]
21-
vulkan-portability = ["core/gfx-backend-vulkan"]
21+
vulkan-portability = ["wgc/gfx-backend-vulkan"]
2222

23-
[dependencies.core]
23+
[dependencies.wgc]
2424
package = "wgpu-core"
25-
#path = "../wgpu-core"
2625
git = "https://github.com/gfx-rs/wgpu"
2726
version = "0.5"
27+
features = ["raw-window-handle", "trace"]
2828

2929
[dependencies.wgt]
3030
package = "wgpu-types"
31-
#path = "../wgpu-types"
3231
git = "https://github.com/gfx-rs/wgpu"
3332
version = "0.5"
3433

@@ -39,6 +38,3 @@ lazy_static = "1.1"
3938
parking_lot = "0.10"
4039
raw-window-handle = "0.3"
4140
libc = {version="0.2", features=[]}
42-
43-
[target.'cfg(target_os = "macos")'.dependencies]
44-
objc = "0.2.7"

cbindgen.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ language = "C"
2020
prefix = "WGPU"
2121
exclude = ["Option_AdapterId", "Option_SurfaceId", "Option_TextureViewId"]
2222

23+
[export.rename]
24+
"BufferDescriptor_Label" = "BufferDescriptor"
25+
"TextureDescriptor_Label" = "TextureDescriptor"
26+
"TextureViewDescriptor_Label" = "TextureViewDescriptor"
27+
"SamplerDescriptor_Label" = "SamplerDescriptor"
28+
2329
[parse]
2430
parse_deps = true
2531
include = ["wgpu-core", "wgpu-types"]

ffi/wgpu.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ typedef struct {
521521
uintptr_t entries_length;
522522
} WGPUBindGroupLayoutDescriptor;
523523

524+
typedef const char *WGPULabel;
525+
524526
typedef uint32_t WGPUBufferUsage;
525527
#define WGPUBufferUsage_MAP_READ 1
526528
#define WGPUBufferUsage_MAP_WRITE 2
@@ -533,7 +535,7 @@ typedef uint32_t WGPUBufferUsage;
533535
#define WGPUBufferUsage_INDIRECT 256
534536

535537
typedef struct {
536-
const char *label;
538+
WGPULabel label;
537539
WGPUBufferAddress size;
538540
WGPUBufferUsage usage;
539541
} WGPUBufferDescriptor;
@@ -652,6 +654,7 @@ typedef struct {
652654
} WGPURenderPipelineDescriptor;
653655

654656
typedef struct {
657+
WGPULabel label;
655658
WGPUAddressMode address_mode_u;
656659
WGPUAddressMode address_mode_v;
657660
WGPUAddressMode address_mode_w;
@@ -692,7 +695,7 @@ typedef struct {
692695
} WGPUSwapChainDescriptor;
693696

694697
typedef struct {
695-
const char *label;
698+
WGPULabel label;
696699
WGPUExtent3d size;
697700
uint32_t mip_level_count;
698701
uint32_t sample_count;
@@ -725,6 +728,7 @@ typedef struct {
725728
} WGPUSwapChainOutput;
726729

727730
typedef struct {
731+
WGPULabel label;
728732
WGPUTextureFormat format;
729733
WGPUTextureViewDimension dimension;
730734
WGPUTextureAspect aspect;

src/command.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::GLOBAL;
22

3-
pub use core::command::{compute_ffi::*, render_ffi::*};
3+
pub use wgc::command::{compute_ffi::*, render_ffi::*};
44

5-
use core::{gfx_select, id};
5+
use wgc::{gfx_select, id};
66

77
#[no_mangle]
88
pub extern "C" fn wgpu_command_encoder_finish(
@@ -33,8 +33,8 @@ pub extern "C" fn wgpu_command_encoder_copy_buffer_to_buffer(
3333
#[no_mangle]
3434
pub extern "C" fn wgpu_command_encoder_copy_buffer_to_texture(
3535
command_encoder_id: id::CommandEncoderId,
36-
source: &core::command::BufferCopyView,
37-
destination: &core::command::TextureCopyView,
36+
source: &wgc::command::BufferCopyView,
37+
destination: &wgc::command::TextureCopyView,
3838
copy_size: wgt::Extent3d,
3939
) {
4040
gfx_select!(command_encoder_id => GLOBAL.command_encoder_copy_buffer_to_texture(
@@ -47,8 +47,8 @@ pub extern "C" fn wgpu_command_encoder_copy_buffer_to_texture(
4747
#[no_mangle]
4848
pub extern "C" fn wgpu_command_encoder_copy_texture_to_buffer(
4949
command_encoder_id: id::CommandEncoderId,
50-
source: &core::command::TextureCopyView,
51-
destination: &core::command::BufferCopyView,
50+
source: &wgc::command::TextureCopyView,
51+
destination: &wgc::command::BufferCopyView,
5252
copy_size: wgt::Extent3d,
5353
) {
5454
gfx_select!(command_encoder_id => GLOBAL.command_encoder_copy_texture_to_buffer(
@@ -61,8 +61,8 @@ pub extern "C" fn wgpu_command_encoder_copy_texture_to_buffer(
6161
#[no_mangle]
6262
pub extern "C" fn wgpu_command_encoder_copy_texture_to_texture(
6363
command_encoder_id: id::CommandEncoderId,
64-
source: &core::command::TextureCopyView,
65-
destination: &core::command::TextureCopyView,
64+
source: &wgc::command::TextureCopyView,
65+
destination: &wgc::command::TextureCopyView,
6666
copy_size: wgt::Extent3d,
6767
) {
6868
gfx_select!(command_encoder_id => GLOBAL.command_encoder_copy_texture_to_texture(
@@ -80,9 +80,9 @@ pub extern "C" fn wgpu_command_encoder_copy_texture_to_texture(
8080
#[no_mangle]
8181
pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
8282
encoder_id: id::CommandEncoderId,
83-
desc: &core::command::RenderPassDescriptor,
84-
) -> *mut core::command::RawPass {
85-
let pass = core::command::RawPass::new_render(encoder_id, desc);
83+
desc: &wgc::command::RenderPassDescriptor,
84+
) -> *mut wgc::command::RawPass {
85+
let pass = wgc::command::RawPass::new_render(encoder_id, desc);
8686
Box::into_raw(Box::new(pass))
8787
}
8888

@@ -98,7 +98,7 @@ pub unsafe extern "C" fn wgpu_render_pass_end_pass(pass_id: id::RenderPassId) {
9898
}
9999

100100
#[no_mangle]
101-
pub unsafe extern "C" fn wgpu_render_pass_destroy(pass: *mut core::command::RawPass) {
101+
pub unsafe extern "C" fn wgpu_render_pass_destroy(pass: *mut wgc::command::RawPass) {
102102
let _ = Box::from_raw(pass).into_vec();
103103
}
104104

@@ -110,9 +110,9 @@ pub unsafe extern "C" fn wgpu_render_pass_destroy(pass: *mut core::command::RawP
110110
#[no_mangle]
111111
pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
112112
encoder_id: id::CommandEncoderId,
113-
_desc: Option<&core::command::ComputePassDescriptor>,
114-
) -> *mut core::command::RawPass {
115-
let pass = core::command::RawPass::new_compute(encoder_id);
113+
_desc: Option<&wgc::command::ComputePassDescriptor>,
114+
) -> *mut wgc::command::RawPass {
115+
let pass = wgc::command::RawPass::new_compute(encoder_id);
116116
Box::into_raw(Box::new(pass))
117117
}
118118

@@ -123,6 +123,6 @@ pub unsafe extern "C" fn wgpu_compute_pass_end_pass(pass_id: id::ComputePassId)
123123
}
124124

125125
#[no_mangle]
126-
pub unsafe extern "C" fn wgpu_compute_pass_destroy(pass: *mut core::command::RawPass) {
126+
pub unsafe extern "C" fn wgpu_compute_pass_destroy(pass: *mut wgc::command::RawPass) {
127127
let _ = Box::from_raw(pass).into_vec();
128128
}

0 commit comments

Comments
 (0)