Skip to content

Commit 97c6daf

Browse files
committed
Fix MTLRasterizationRateMapDescriptor method
Fix `rasterizationRateMapDescriptorWithScreenSize:layerCount:layers:` having the last parameter emitted as an out pointer.
1 parent 5dc0697 commit 97c6daf

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

framework-crates/objc2-metal/src/rasterization_rate.rs

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::MTLRasterizationRateLayerDescriptor;
1+
use crate::{MTLRasterizationRateLayerDescriptor, MTLRasterizationRateMapDescriptor};
22
use objc2::extern_methods;
33

44
impl MTLRasterizationRateLayerDescriptor {
@@ -11,3 +11,26 @@ impl MTLRasterizationRateLayerDescriptor {
1111
pub fn sampleCount(&self) -> crate::MTLSize;
1212
);
1313
}
14+
15+
impl MTLRasterizationRateMapDescriptor {
16+
extern_methods!(
17+
#[cfg(feature = "MTLTypes")]
18+
/// Convenience descriptor creation function for an arbitrary amount of layers stored in a C-array.
19+
///
20+
/// Parameter `screenSize`: The dimensions, in screen space pixels, of the region where variable rasterization is applied. The depth component of MTLSize is ignored.
21+
///
22+
/// Parameter `layerCount`: The number of layers in the descriptor.
23+
///
24+
/// Parameter `layers`: An array of pointers to layer descriptors. The array must contain layerCount non-null pointers to MTLRasterizationRateLayerDescriptor instances.
25+
///
26+
/// Returns: A descriptor containing all the specified layers. Add or remove layers using setObject:atIndexedSubscript:.
27+
///
28+
/// The function copies the array of pointers internally, the caller need not keep the array alive after creating the descriptor.
29+
#[unsafe(method(rasterizationRateMapDescriptorWithScreenSize:layerCount:layers:))]
30+
pub unsafe fn rasterizationRateMapDescriptorWithScreenSize_layerCount_layers(
31+
screen_size: crate::MTLSize,
32+
layer_count: objc2_foundation::NSUInteger,
33+
layers: core::ptr::NonNull<core::ptr::NonNull<MTLRasterizationRateLayerDescriptor>>,
34+
) -> objc2::rc::Retained<MTLRasterizationRateMapDescriptor>;
35+
);
36+
}

framework-crates/objc2-metal/translation-config.toml

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ visionos = "1.0"
1111
# Duplicated property
1212
class.MTLRasterizationRateLayerDescriptor.methods.sampleCount.skipped = true
1313

14+
# Gets emitted as an out pointer, but the pointer is actually an array.
15+
# Swift also skips this.
16+
class.MTLRasterizationRateMapDescriptor.methods."rasterizationRateMapDescriptorWithScreenSize:layerCount:layers:".skipped = true
17+
1418
# Needs dispatch
1519
class.MTLSharedEventListener.methods."initWithDispatchQueue:".skipped = true
1620
class.MTLSharedEventListener.methods.dispatchQueue.skipped = true

generated

0 commit comments

Comments
 (0)