Skip to content

Commit 461148e

Browse files
committed
Align texture API with Metal
1 parent 6beb0a3 commit 461148e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "metal"
3-
version = "0.18.0"
3+
version = "0.19.0"
44
description = "Rust bindings for Metal"
55
documentation = "https://docs.rs/crate/metal"
66
homepage = "https://github.com/gfx-rs/metal-rs"

examples/headless-render/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ fn save_image(texture: &TextureRef) {
8585

8686
texture.get_bytes(
8787
image.as_mut_ptr() as *mut std::ffi::c_void,
88+
VIEW_WIDTH * 4,
8889
MTLRegion {
8990
origin: MTLOrigin { x: 0, y: 0, z: 0 },
9091
size: MTLSize {
@@ -94,7 +95,6 @@ fn save_image(texture: &TextureRef) {
9495
},
9596
},
9697
0,
97-
VIEW_WIDTH * 4,
9898
);
9999

100100
let out_file =

src/texture.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ impl TextureRef {
238238
pub fn get_bytes(
239239
&self,
240240
bytes: *mut std::ffi::c_void,
241+
stride: NSUInteger,
241242
region: MTLRegion,
242243
mipmap_level: NSUInteger,
243-
stride: NSUInteger,
244244
) {
245245
unsafe {
246246
msg_send![self, getBytes:bytes
@@ -253,10 +253,10 @@ impl TextureRef {
253253
pub fn get_bytes_in_slice(
254254
&self,
255255
bytes: *mut std::ffi::c_void,
256-
region: MTLRegion,
257-
mipmap_level: NSUInteger,
258256
stride: NSUInteger,
259257
image_stride: NSUInteger,
258+
region: MTLRegion,
259+
mipmap_level: NSUInteger,
260260
slice: NSUInteger,
261261
) {
262262
unsafe {
@@ -273,8 +273,8 @@ impl TextureRef {
273273
&self,
274274
region: MTLRegion,
275275
mipmap_level: NSUInteger,
276-
stride: NSUInteger,
277276
bytes: *const std::ffi::c_void,
277+
stride: NSUInteger,
278278
) {
279279
unsafe {
280280
msg_send![self, replaceRegion:region
@@ -288,10 +288,10 @@ impl TextureRef {
288288
&self,
289289
region: MTLRegion,
290290
mipmap_level: NSUInteger,
291-
image_stride: NSUInteger,
292-
stride: NSUInteger,
293291
slice: NSUInteger,
294292
bytes: *const std::ffi::c_void,
293+
stride: NSUInteger,
294+
image_stride: NSUInteger,
295295
) {
296296
unsafe {
297297
msg_send![self, replaceRegion:region

0 commit comments

Comments
 (0)