Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ winapi = { version = "0.3", features = [
libc = "0.2"
ndk-sys = "0.2"

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))'.dependencies]
objc = { package = "objc-rs", version = "0.2" }

[dev-dependencies]
Expand Down
17 changes: 12 additions & 5 deletions src/graphics/metal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ const NUM_INFLIGHT_FRAMES: usize = 3;
// uniform-buffer offset alignment.
#[cfg(any(
target_os = "macos",
all(target_os = "ios", any(target_arch = "x86_64", target_abi = "sim")),
all(
any(target_os = "ios", target_os = "tvos"),
any(target_arch = "x86_64", target_abi = "sim"),
),
))]
const UNIFORM_BUFFER_ALIGN: u64 = 256;
#[cfg(all(target_os = "ios", target_arch = "aarch64", not(target_abi = "sim")))]
#[cfg(all(
any(target_os = "ios", target_os = "tvos"),
target_arch = "aarch64",
not(target_abi = "sim"),
))]
const UNIFORM_BUFFER_ALIGN: u64 = 16;

impl From<VertexFormat> for MTLVertexFormat {
Expand Down Expand Up @@ -357,7 +364,7 @@ impl MetalContext {
MTLResourceOptions::CPUCacheModeWriteCombined
| MTLResourceOptions::StorageModeManaged
};
#[cfg(target_os = "ios")]
#[cfg(any(target_os = "ios", target_os = "tvos"))]
let options = { MTLResourceOptions::CPUCacheModeWriteCombined };

let uniform_buffers = [
Expand Down Expand Up @@ -655,7 +662,7 @@ impl RenderingBackend for MetalContext {
MTLResourceOptions::CPUCacheModeWriteCombined
| MTLResourceOptions::StorageModeManaged
}
#[cfg(target_os = "ios")]
#[cfg(any(target_os = "ios", target_os = "tvos"))]
{
MTLResourceOptions::CPUCacheModeWriteCombined
}
Expand Down Expand Up @@ -806,7 +813,7 @@ impl RenderingBackend for MetalContext {
setResourceOptions: MTLResourceOptions::StorageModeManaged
];
}
#[cfg(target_os = "ios")]
#[cfg(any(target_os = "ios", target_os = "tvos"))]
{
msg_send_![descriptor, setStorageMode: MTLStorageMode::Shared];
msg_send_![
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ pub mod window {
let d = native_display().lock().unwrap();
d.view
}
#[cfg(target_os = "ios")]
#[cfg(any(target_os = "ios", target_os = "tvos"))]
pub fn apple_view_ctrl() -> crate::native::apple::frameworks::ObjcId {
let d = native_display().lock().unwrap();
d.view_ctrl
Expand Down Expand Up @@ -510,7 +510,7 @@ where
native::macos::run(conf, f);
}

#[cfg(target_os = "ios")]
#[cfg(any(target_os = "ios", target_os = "tvos"))]
unsafe {
native::ios::run(conf, f);
}
Expand Down
8 changes: 4 additions & 4 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) struct NativeDisplayData {

#[cfg(target_vendor = "apple")]
pub view: crate::native::apple::frameworks::ObjcId,
#[cfg(target_os = "ios")]
#[cfg(any(target_os = "ios", target_os = "tvos"))]
pub view_ctrl: crate::native::apple::frameworks::ObjcId,
#[cfg(target_vendor = "apple")]
pub gfx_api: crate::conf::AppleGfxApi,
Expand Down Expand Up @@ -60,7 +60,7 @@ impl NativeDisplayData {
gfx_api: crate::conf::AppleGfxApi::OpenGl,
#[cfg(target_vendor = "apple")]
view: std::ptr::null_mut(),
#[cfg(target_os = "ios")]
#[cfg(any(target_os = "ios", target_os = "tvos"))]
view_ctrl: std::ptr::null_mut(),
}
}
Expand Down Expand Up @@ -105,13 +105,13 @@ pub use android::*;
#[cfg(target_arch = "wasm32")]
pub mod wasm;

#[cfg(any(target_os = "macos", target_os = "ios"))]
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
pub mod apple;

#[cfg(target_os = "macos")]
pub mod macos;

#[cfg(target_os = "ios")]
#[cfg(any(target_os = "ios", target_os = "tvos"))]
pub mod ios;

#[cfg(any(target_os = "android", target_os = "linux"))]
Expand Down
2 changes: 1 addition & 1 deletion src/native/apple/frameworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub enum GLKViewDrawableStencilFormat {
FormatNone = 0,
Format8,
}
#[cfg(target_os = "ios")]
#[cfg(any(target_os = "ios", target_os = "tvos"))]
#[link(name = "UIKit", kind = "framework")]
extern "C" {
pub static UIKeyboardDidShowNotification: ObjcId;
Expand Down
Loading