gfx-rs / metal-rs

Rust bindings for Metal
Apache License 2.0
591 stars 112 forks source link

Add inline attribute to deref #233

Closed peterwmwong closed 2 years ago

peterwmwong commented 2 years ago

While examining the release build assembly, I noticed a branch that precedes any call to an Objective-C parent type method.

For example, color_attachment.set_texture(Some(texture));...

...
Ltmp157:
    mov x0, x25
    bl  __ZN101_$LT$metal..renderpass..RenderPassColorAttachmentDescriptorRef$u20$as$u20$core..ops..deref..Deref$GT$5deref17h157b1b3f5a4ba402E
Ltmp158:
Ltmp159:
    mov x1, x26
    bl  __ZN5metal10renderpass33RenderPassAttachmentDescriptorRef11set_texture17he4f575ac4d07711eE
...
__ZN101_$LT$metal..renderpass..RenderPassColorAttachmentDescriptorRef$u20$as$u20$core..ops..deref..Deref$GT$5deref17h157b1b3f5a4ba402E:
    .cfi_startproc
    ret
    .cfi_endproc

Seems like an easy improvement without requiring users to commit to LTO.