Skip to content

Commit

Permalink
some stuff with more encoders
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonsdaleiter committed May 11, 2020
1 parent e81ab1b commit 5b80ab1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Backfill List
-
**HIGH PRIORITY**:
- [ ] Tessellation drawing
- [ ] Remainder of command buffer instance methods
- [ ] Compute + blit + resource state encoder
- [ ] Redo all the docs

**LOW PRIORITY**:
Expand Down
8 changes: 4 additions & 4 deletions src/commandbuffer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::import_objc_macros::*;
use crate::{
handle, DeviceCreated, MTLDrawable, MTLParallelRenderCommandEncoder, MTLRenderCommandEncoder,
MTLRenderPassDescriptor, NSError, Object, ObjectPointer,
};
use crate::{handle, DeviceCreated, MTLDrawable, MTLParallelRenderCommandEncoder, MTLRenderCommandEncoder, MTLRenderPassDescriptor, NSError, Object, ObjectPointer, MTLComputeCommandEncoder};

#[repr(u64)]
pub enum MTLCommandBufferStatus {
Expand Down Expand Up @@ -78,6 +75,9 @@ impl MTLCommandBuffer {
parallelRenderCommandEncoderWithDescriptor:desc.get_ptr()
])
}
pub unsafe fn new_compute_command_encoder(&self) -> MTLComputeCommandEncoder {
MTLComputeCommandEncoder::from_ptr(msg_send![self.get_ptr(), computeCommandEncoder])
}
}

impl Object for MTLCommandBuffer {
Expand Down
21 changes: 21 additions & 0 deletions src/encoder/compute.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use crate::{ObjectPointer, handle, Object, MTLCommandEncoder};

pub struct MTLComputeCommandEncoder(ObjectPointer);
handle!(MTLComputeCommandEncoder);

impl MTLComputeCommandEncoder {
// TODO add my behavior
}

impl MTLCommandEncoder for MTLComputeCommandEncoder {}

impl Object for MTLComputeCommandEncoder {
unsafe fn from_ptr(ptr: ObjectPointer) -> Self where
Self: Sized {
MTLComputeCommandEncoder(ptr)
}

fn get_ptr(&self) -> ObjectPointer {
self.0
}
}
2 changes: 2 additions & 0 deletions src/encoder/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
mod compute;
mod pass;
mod render;
pub use compute::*;
pub use pass::*;
pub use render::*;

Expand Down

0 comments on commit 5b80ab1

Please sign in to comment.