-
Notifications
You must be signed in to change notification settings - Fork 344
Description
Metal has Indirect Command Buffers. Direct3D 12 has Bundles. Vulkan has secondary command buffers.
Unfortunately, not all hardware supports these facilities directly. Metal indirect command buffers are behind the MTLFeatureSet_macOS_GPUFamily2_v1 and MTLFeatureSet_iOS_GPUFamily3_v4 feature sets. From the docs, this looks like iPhone 6s and later and most Macs from 2016 or later.
It is, of course, possible to emulate this functionality by "recording" commands into a browser-owned log, and then "executing" the commands by running through the log and issuing the commands directly. Presumably this would cost significant performance, as otherwise the feature wouldn't exist in the 3D APIs directly.
Inside an indirect command buffer, Metal doesn't allow compute commands. For rendering commands, it supports:
- Draw calls
- Setting buffers (this includes argument buffers, which can include references to textures / samplers)
- Setting the pipeline state object
Inside a Bundle, Direct3D 12 supports everything except:
- Any Clear method
- Any Copy method
- DiscardResource
- ExecuteBundle
- ResourceBarrier
- ResolveSubresource
- SetPredication
- BeginQuery
- EndQuery
- SOSetTargets
- OMSetRenderTargets
- RSSetViewports
- RSSetScissorRects
- SetDescriptorHeaps
From my reading, Vulkan secondary command buffers can record any command, but a subpass that vkCmdExecuteCommands(secondaryCommandBuffer) isn't allowed to do anything except call vkCmdExecuteCommands(). Presumably this means a secondary command buffer can't change the render target either.