Skip to content

Commit

Permalink
Rename gpu_resource_id to gpu_res_id
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Nov 4, 2024
1 parent 00196d2 commit ce6059d
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cidre/src/mtl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ macro_rules! define_mtl {
pub fn set_depth(&mut self, val: usize);
};

(gpu_resource_id) => {
(gpu_res_id) => {
#[$crate::objc::msg_send(gpuResourceID)]
pub fn gpu_resource_id(&self) -> crate::mtl::ResId;
};
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/mtl/acceleration_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl AccelerationStructure {
#[objc::msg_send(size)]
pub fn size(&self) -> usize;

define_mtl!(gpu_resource_id);
define_mtl!(gpu_res_id);
}

extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/mtl/compute_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ define_obj_type!(
);

impl State {
define_mtl!(gpu_resource_id);
define_mtl!(gpu_res_id);

#[objc::msg_send(device)]
pub fn device(&self) -> arc::R<mtl::Device>;
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/mtl/indirect_command_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ define_obj_type!(
);

impl IndirectCmdBuf {
define_mtl!(gpu_resource_id);
define_mtl!(gpu_res_id);

#[objc::msg_send(size)]
pub fn size(&self) -> usize;
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/mtl/intersection_function_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Desc {
define_obj_type!(pub IntersectionFnTable(mtl::Res));

impl IntersectionFnTable {
define_mtl!(gpu_resource_id);
define_mtl!(gpu_res_id);

#[objc::msg_send(setBuffer:atIndex:)]
pub fn set_buf_at(&mut self, buf: Option<&mtl::Buf>, index: usize);
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/mtl/render_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ define_obj_type!(pub FnsDesc(ns::Id));
define_obj_type!(pub State(ns::Id));

impl State {
define_mtl!(gpu_resource_id);
define_mtl!(gpu_res_id);

#[objc::msg_send(device)]
pub fn device(&self) -> arc::R<mtl::Device>;
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/mtl/sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ define_obj_type!(
pub State(ns::Id));

impl State {
define_mtl!(gpu_resource_id);
define_mtl!(gpu_res_id);

#[objc::msg_send(device)]
pub fn device(&self) -> arc::R<mtl::Device>;
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/mtl/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ define_obj_type!(
);

impl Texture {
define_mtl!(width, height, depth, gpu_resource_id);
define_mtl!(width, height, depth, gpu_res_id);

/// The texture this texture view was created from, or [`None`] if this is not
/// a texture view or it was not created from a texture.
Expand Down
18 changes: 18 additions & 0 deletions cidre/src/mtl/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ pub struct Size {
pub depth: ns::UInteger,
}

impl Size {
#[inline]
pub fn _2d(width: usize, height: usize) -> Self {
Self {
width,
height,
depth: 1,
}
}
}

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
#[repr(C)]
pub struct Origin {
Expand All @@ -16,6 +27,13 @@ pub struct Origin {
pub z: usize,
}

impl Origin {
#[inline]
pub fn zero() -> Self {
Self::default()
}
}

/// Handle of the GPU resource suitable for storing in an Argument Buffer
#[doc(alias = "MTLResourceID")]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/mtl/visible_function_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define_obj_type!(
);

impl VisibleFnTable {
define_mtl!(gpu_resource_id);
define_mtl!(gpu_res_id);

/// Sets a table entry to point to a callable function.
#[objc::msg_send(setFunction:atIndex:)]
Expand Down

0 comments on commit ce6059d

Please sign in to comment.