|
1 |
| -use objc2::{msg_send, msg_send_id, rc::Retained, runtime::ProtocolObject}; |
| 1 | +use objc2::{msg_send_id, rc::Retained, runtime::ProtocolObject}; |
2 | 2 | use objc2_foundation::{ns_string, NSError, NSRange, NSString};
|
3 | 3 | use objc2_metal::{
|
4 | 4 | MTLBuffer, MTLCaptureManager, MTLCaptureScope, MTLCommandBuffer, MTLCommandBufferStatus,
|
5 | 5 | MTLCompileOptions, MTLComputePipelineDescriptor, MTLComputePipelineState,
|
6 | 6 | MTLCounterSampleBufferDescriptor, MTLCounterSet, MTLDepthClipMode, MTLDepthStencilDescriptor,
|
7 | 7 | MTLDevice, MTLFunction, MTLLanguageVersion, MTLLibrary, MTLMutability,
|
8 | 8 | MTLPipelineBufferDescriptorArray, MTLPixelFormat, MTLPrimitiveTopologyClass,
|
9 |
| - MTLRenderPipelineDescriptor, MTLResourceOptions, MTLSamplerAddressMode, MTLSamplerDescriptor, |
10 |
| - MTLSamplerMipFilter, MTLSize, MTLStencilDescriptor, MTLStorageMode, MTLTexture, |
11 |
| - MTLTextureDescriptor, MTLTextureType, MTLTriangleFillMode, MTLVertexDescriptor, |
| 9 | + MTLRenderPipelineDescriptor, MTLResource, MTLResourceOptions, MTLSamplerAddressMode, |
| 10 | + MTLSamplerDescriptor, MTLSamplerMipFilter, MTLSize, MTLStencilDescriptor, MTLStorageMode, |
| 11 | + MTLTexture, MTLTextureDescriptor, MTLTextureType, MTLTriangleFillMode, MTLVertexDescriptor, |
12 | 12 | MTLVertexStepFunction,
|
13 | 13 | };
|
14 | 14 | use parking_lot::Mutex;
|
@@ -332,7 +332,7 @@ impl crate::Device for super::Device {
|
332 | 332 | .newBufferWithLength_options(desc.size as usize, options)
|
333 | 333 | .unwrap();
|
334 | 334 | if let Some(label) = desc.label {
|
335 |
| - set_buffer_label(&raw, Some(&NSString::from_str(label))); |
| 335 | + raw.setLabel(Some(&NSString::from_str(label))); |
336 | 336 | }
|
337 | 337 | Ok(super::Buffer {
|
338 | 338 | raw,
|
@@ -403,7 +403,7 @@ impl crate::Device for super::Device {
|
403 | 403 | .newTextureWithDescriptor(&descriptor)
|
404 | 404 | .ok_or(crate::DeviceError::OutOfMemory)?;
|
405 | 405 | if let Some(label) = desc.label {
|
406 |
| - set_texture_label(&raw, Some(&NSString::from_str(label))); |
| 406 | + raw.setLabel(Some(&NSString::from_str(label))); |
407 | 407 | }
|
408 | 408 |
|
409 | 409 | Ok(super::Texture {
|
@@ -474,7 +474,7 @@ impl crate::Device for super::Device {
|
474 | 474 | )
|
475 | 475 | .unwrap();
|
476 | 476 | if let Some(label) = desc.label {
|
477 |
| - set_texture_label(&raw, Some(&NSString::from_str(label))); |
| 477 | + raw.setLabel(Some(&NSString::from_str(label))); |
478 | 478 | }
|
479 | 479 | raw
|
480 | 480 | })
|
@@ -1155,7 +1155,7 @@ impl crate::Device for super::Device {
|
1155 | 1155 | .newBufferWithLength_options(size as usize, options)
|
1156 | 1156 | .unwrap();
|
1157 | 1157 | if let Some(label) = desc.label {
|
1158 |
| - set_buffer_label(&raw_buffer, Some(&NSString::from_str(label))); |
| 1158 | + raw_buffer.setLabel(Some(&NSString::from_str(label))); |
1159 | 1159 | }
|
1160 | 1160 | Ok(super::QuerySet {
|
1161 | 1161 | raw_buffer,
|
@@ -1313,16 +1313,6 @@ impl crate::Device for super::Device {
|
1313 | 1313 | }
|
1314 | 1314 | }
|
1315 | 1315 |
|
1316 |
| -// TODO: `label` is not exposed on `MTLBuffer`, is this always correct? |
1317 |
| -fn set_buffer_label(buffer: &ProtocolObject<dyn MTLBuffer>, label: Option<&NSString>) { |
1318 |
| - unsafe { msg_send![buffer, setLabel: label] } |
1319 |
| -} |
1320 |
| - |
1321 |
| -// TODO: `label` is not exposed on `MTLTexture`, is this always correct? |
1322 |
| -fn set_texture_label(buffer: &ProtocolObject<dyn MTLTexture>, label: Option<&NSString>) { |
1323 |
| - unsafe { msg_send![buffer, setLabel: label] } |
1324 |
| -} |
1325 |
| - |
1326 | 1316 | // TODO: `newComputePipelineStateWithDescriptor:error:` is not exposed on
|
1327 | 1317 | // `MTLDevice`, is this always correct?
|
1328 | 1318 | fn new_compute_pipeline_state_with_descriptor(
|
|
0 commit comments