Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newTextureWithDescriptor:iosurface:plane: #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,10 @@ type MTLNewRenderPipelineStateWithReflectionCompletionHandler = extern fn(render
type MTLNewComputePipelineStateCompletionHandler = extern fn(computePipelineState: id, error: id);
type MTLNewComputePipelineStateWithReflectionCompletionHandler = extern fn(computePipelineState: id, reflection: id, error: id);*/

#[derive(Debug, Copy, Clone)]
pub enum _IOSurface { }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably declare it as a full-featured foreign_obj_type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

pub type IOSurfaceRef = *mut _IOSurface;

pub enum MTLDevice {}

foreign_obj_type! {
Expand Down Expand Up @@ -1665,6 +1669,14 @@ impl DeviceRef {
pub fn new_texture(&self, descriptor: &TextureDescriptorRef) -> Texture {
unsafe { msg_send![self, newTextureWithDescriptor: descriptor] }
}

pub fn new_texture_with_surface_plane(&self, descriptor: &TextureDescriptorRef, iosurface: IOSurfaceRef, plane: NSUInteger) -> Texture {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like with other ref arguments, we should use &IOSurfaceRef
I suppose this is directly related to making IOSurface to be a real foreign type

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsafe {
msg_send![self, newTextureWithDescriptor: descriptor
iosurface: iosurface
plane: plane]
}
}

pub fn new_sampler(&self, descriptor: &SamplerDescriptorRef) -> SamplerState {
unsafe { msg_send![self, newSamplerStateWithDescriptor: descriptor] }
Expand Down