Skip to content

Commit

Permalink
Minimal cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Oct 3, 2024
1 parent cc4e345 commit a11a12c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ targets = [

[dependencies]
objc2 = { version = "0.5", default-features = false }
objc2-metal = { version = "0.2.2", default-features = false, features = ["alloc", "std", "MTLResource", "MTLBuffer", "MTLTexture", "MTLSampler", "MTLTypes"] }
objc2-metal = { version = "0.2.2", default-features = false, features = ["std", "MTLResource", "MTLBuffer", "MTLTexture", "MTLSampler", "MTLTypes"] }
10 changes: 4 additions & 6 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub mod bindings {
pub use bindings as ffi;

use objc2::runtime::ProtocolObject;
use objc2_metal::{MTLBuffer, MTLSamplerState, MTLTexture};
use objc2_metal::{MTLBuffer, MTLResourceID, MTLSamplerState, MTLTexture};

/// Rust version of `IRBufferView` using [`metal`] types.
#[doc(alias = "IRBufferView")]
Expand Down Expand Up @@ -58,7 +58,7 @@ impl ffi::IRDescriptorTableEntry {
gpuVA: buffer_view.buffer.gpuAddress() + buffer_view.buffer_offset,
textureViewID: match buffer_view.texture_buffer_view {
Some(texture) => unsafe {
std::mem::transmute::<objc2_metal::MTLResourceID, u64>(texture.gpuResourceID())
std::mem::transmute::<MTLResourceID, u64>(texture.gpuResourceID())
},
None => 0,
},
Expand All @@ -76,7 +76,7 @@ impl ffi::IRDescriptorTableEntry {
Self {
gpuVA: 0,
textureViewID: unsafe {
std::mem::transmute::<objc2_metal::MTLResourceID, u64>(argument.gpuResourceID())
std::mem::transmute::<MTLResourceID, u64>(argument.gpuResourceID())
},
metadata: min_lod_clamp.to_bits() as u64 | (METADATA as u64) << 32,
}
Expand All @@ -90,9 +90,7 @@ impl ffi::IRDescriptorTableEntry {
#[allow(unused_variables, unreachable_code, dead_code)]
pub fn sampler(argument: &ProtocolObject<dyn MTLSamplerState>, lod_bias: f32) -> Self {
Self {
gpuVA: unsafe {
std::mem::transmute::<objc2_metal::MTLResourceID, u64>(argument.gpuResourceID())
},
gpuVA: unsafe { std::mem::transmute::<MTLResourceID, u64>(argument.gpuResourceID()) },
textureViewID: 0,
metadata: lod_bias.to_bits() as u64,
}
Expand Down

0 comments on commit a11a12c

Please sign in to comment.