Skip to content

Commit 608c613

Browse files
committed
sampler: Add missing gpu_resource_id() getter
According to the upstream docs and the Metal Shader Converter implementation the `SamplerState` type has a way to get access to its `MTLResourceID` on the GPU: https://developer.apple.com/documentation/metal/mtlsamplerstate/3974101-gpuresourceid
1 parent 864417d commit 608c613

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/sampler.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// http://opensource.org/licenses/MIT>, at your option. This file may not be
66
// copied, modified, or distributed except according to those terms.
77

8-
use super::{depthstencil::MTLCompareFunction, DeviceRef, NSUInteger};
8+
use super::{depthstencil::MTLCompareFunction, DeviceRef, MTLResourceID, NSUInteger};
99

1010
/// See <https://developer.apple.com/documentation/metal/mtlsamplerminmagfilter>
1111
#[repr(u64)]
@@ -158,4 +158,8 @@ impl SamplerStateRef {
158158
crate::nsstring_as_str(label)
159159
}
160160
}
161+
162+
pub fn gpu_resource_id(&self) -> MTLResourceID {
163+
unsafe { msg_send![self, gpuResourceID] }
164+
}
161165
}

0 commit comments

Comments
 (0)