8000 metal: use 256-byte uniform alignment on iOS simulator by benface · Pull Request #636 · not-fl3/miniquad · GitHub
[go: up one dir, main page]

Skip to content
< 7FFF header class="root__q6pgdo HeaderMktg header-logged-out fullWidth__R5BAbe" role="banner" data-marketing-header="true" data-color-mode="dark" data-light-theme="light" data-dark-theme="dark">

Navigation Menu

Merged
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
13 changes: 11 additions & 2 deletions src/graphics/metal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@ use super::*;
// https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
const MAX_UNIFORM_BUFFER_SIZE: u64 = 4 * 1024 * 1024;
const NUM_INFLIGHT_FRAMES: usize = 3;
#[cfg(any(target_os = "macos", all(target_os = "ios", target_arch = "x86_64")))]
// iOS simulator on Apple Silicon Macs (`target_abi = "sim"`) runs
// iOS arm64 code but issues Metal commands against the host Mac's
// GPU — which validates with the 256-byte rule, not iOS arm64's
// 16-byte. Without breaking the simulator out of the iOS-arm64
// branch below, the first draw fails Metal validation on
// uniform-buffer offset alignment.
#[cfg(any(
target_os = "macos",
all(target_os = "ios", any(target_arch = "x86_64", target_abi = "sim")),
))]
const UNIFORM_BUFFER_ALIGN: u64 = 256;
#[cfg(all(target_os = "ios", not(target_arch = "x86_64")))]
#[cfg(all(target_os = "ios", target_arch = "aarch64", not(target_abi = "sim")))]
const UNIFORM_BUFFER_ALIGN: u64 = 16;

impl From<VertexFormat> for MTLVertexFormat {
Expand Down
Loading
0