Skip to content

Commit

Permalink
Fix MTLRasterizationRateMapDescriptor method
Browse files Browse the repository at this point in the history
Fix `rasterizationRateMapDescriptorWithScreenSize:layerCount:layers:`
having the last parameter emitted as an out pointer.
  • Loading branch information
madsmtm committed Jan 22, 2025
1 parent 5dc0697 commit 97c6daf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
25 changes: 24 additions & 1 deletion framework-crates/objc2-metal/src/rasterization_rate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::MTLRasterizationRateLayerDescriptor;
use crate::{MTLRasterizationRateLayerDescriptor, MTLRasterizationRateMapDescriptor};
use objc2::extern_methods;

impl MTLRasterizationRateLayerDescriptor {
Expand All @@ -11,3 +11,26 @@ impl MTLRasterizationRateLayerDescriptor {
pub fn sampleCount(&self) -> crate::MTLSize;
);
}

impl MTLRasterizationRateMapDescriptor {
extern_methods!(
#[cfg(feature = "MTLTypes")]
/// Convenience descriptor creation function for an arbitrary amount of layers stored in a C-array.
///
/// Parameter `screenSize`: The dimensions, in screen space pixels, of the region where variable rasterization is applied. The depth component of MTLSize is ignored.
///
/// Parameter `layerCount`: The number of layers in the descriptor.
///
/// Parameter `layers`: An array of pointers to layer descriptors. The array must contain layerCount non-null pointers to MTLRasterizationRateLayerDescriptor instances.
///
/// Returns: A descriptor containing all the specified layers. Add or remove layers using setObject:atIndexedSubscript:.
///
/// The function copies the array of pointers internally, the caller need not keep the array alive after creating the descriptor.
#[unsafe(method(rasterizationRateMapDescriptorWithScreenSize:layerCount:layers:))]
pub unsafe fn rasterizationRateMapDescriptorWithScreenSize_layerCount_layers(
screen_size: crate::MTLSize,
layer_count: objc2_foundation::NSUInteger,
layers: core::ptr::NonNull<core::ptr::NonNull<MTLRasterizationRateLayerDescriptor>>,
) -> objc2::rc::Retained<MTLRasterizationRateMapDescriptor>;
);
}
4 changes: 4 additions & 0 deletions framework-crates/objc2-metal/translation-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ visionos = "1.0"
# Duplicated property
class.MTLRasterizationRateLayerDescriptor.methods.sampleCount.skipped = true

# Gets emitted as an out pointer, but the pointer is actually an array.
# Swift also skips this.
class.MTLRasterizationRateMapDescriptor.methods."rasterizationRateMapDescriptorWithScreenSize:layerCount:layers:".skipped = true

# Needs dispatch
class.MTLSharedEventListener.methods."initWithDispatchQueue:".skipped = true
class.MTLSharedEventListener.methods.dispatchQueue.skipped = true
Expand Down
2 changes: 1 addition & 1 deletion generated

0 comments on commit 97c6daf

Please sign in to comment.