Trouble creating IndirectCommandBuffer

I'm trying to create and use an indirect command buffer as illustrated in the WWDC session "Metal for Game Developers" this week.


https://developer.apple.com/videos/play/wwdc2018/607/


// Create an Indirect Command Buffer

let desc = MTLIndirectCommandBufferDescriptor()

desc.commandTypes = .draw

desc.inheritBuffers = false

desc.inheritPipelineState = false

desc.maxFragmentBufferBindCount = 1

desc.maxVertexBufferBindCount = 1


// This is not working!

indirectCommandBuffer = device.newIndirectCommandBuffer(with: desc, maxCommandCount: 10, options: MTLResourceOptions.storageModePrivate )


I'm getting the following error:


2018-06-09 13:11:59.852012-0400 Metal DEM[1289:30399] -[NVMTLDevice newIndirectCommandBufferWithDescriptor:maxCount:options:]: unrecognized selector sent to instance 0x101848400

2018-06-09 13:11:59.852718-0400 Metal DEM[1289:30399] [General] -[NVMTLDevice newIndirectCommandBufferWithDescriptor:maxCount:options:]: unrecognized selector sent to instance 0x101848400

2018-06-09 13:11:59.854489-0400 Metal DEM[1289:30399] [General] (

0 CoreFoundation 0x00007fff311ea16a __exceptionPreprocess + 197

1 libobjc.A.dylib 0x00007fff5d113b10 objc_exception_throw + 48

2 CoreFoundation 0x00007fff31272793 -[NSObject(NSObject) __retain_OA] + 0

3 CoreFoundation 0x00007fff31177c43 ___forwarding___ + 789

4 CoreFoundation 0x00007fff31177898 _CF_forwarding_prep_0 + 120

5 Metal 0x00007fff363a9c06 -[MTLIOAccelDevice newIndirectCommandBufferWithDescriptor:maxCommandCount:options:] + 34

6 MetalTools 0x00007fff5093645a -[MTLDebugDevice newIndirectCommandBufferWithDescriptor:maxCommandCount:options:] + 101

7 Metal DEM 0x0000000100019e61 $S9Metal_DEM14ViewControllerC21IndirectCommandBufferyyypF + 9361

8 Metal DEM 0x000000010001ae5a $S9Metal_DEM14ViewControllerC8OpenFileyyypF + 58

9 Metal DEM 0x000000010001aeac $S9Metal_DEM14ViewControllerC8OpenFileyyypFTo + 76

10 AppKit 0x00007fff2ee6d7b4 -[NSApplication(NSResponder) sendAction:to:from:] + 312

...

)


I'm getting a similar error when trying to run the example code on 10.14 Beta (18A293u)


https://developer.apple.com/documentation/metal/fundamental_lessons/basic_indirect_command_buffers


2018-06-09 13:30:12.410842-0400 BasicIndirectCommandBufferCPUEncoding-MacOS[1727:51776] -[NVMTLDevice newIndirectCommandBufferWithDescriptor:maxCount:options:]: unrecognized selector sent to instance 0x103029a00

2018-06-09 13:30:12.410952-0400 BasicIndirectCommandBufferCPUEncoding-MacOS[1727:51776] Failed to set (contentViewController) user defined inspected property on (NSWindow): -[NVMTLDevice newIndirectCommandBufferWithDescriptor:maxCount:options:]: unrecognized selector sent to instance 0x103029a00


Any idea what I'm doing wrong?

Accepted Reply

You're doing nothing wrong. Indirect Command Buffers are not supported by nVidia GPUs.


Our sample code needs a fix to check for the proper Metal Feature Set so that it only runs on GPUs which support the feature and otherwise error out with a useful message.

Replies

You're doing nothing wrong. Indirect Command Buffers are not supported by nVidia GPUs.


Our sample code needs a fix to check for the proper Metal Feature Set so that it only runs on GPUs which support the feature and otherwise error out with a useful message.