-
Notifications
You must be signed in to change notification settings - Fork 329
Description
I found some additional limitations if we want it to be possible to back GPURenderBundles native objects (Indirect command buffers, Bundles, secondary command buffers). As discussed previously, it is up to the implementation to use native objects, but for now it should still be possible to do so. Limitations can be lifted in the future.
D3D12
https://docs.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_command_list_type
D3D12_COMMAND_LIST_TYPE_BUNDLE: Specifies a command buffer that can be executed only directly via a direct command list. A bundle command list inherits all GPU state (except for the currently set pipeline state object and primitive topology).
Bundles inherit all state from the parent command list on which ExecuteBundle is called, except the pipeline state object and primitive topology. All of the state that is set in a bundle will affect the state of the parent command list. Note that ExecuteBundle is not a predicated operation.
Metal
Provides inheritBuffers
and inheritPipelineState
to configure what state is inherited.
Vulkan
https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/vkEndCommandBuffer.html
- If commandBuffer is a secondary command buffer, there must not be an outstanding vkCmdBeginDebugUtilsLabelEXTcommand recorded to commandBuffer that has not previously been ended by a call to vkCmdEndDebugUtilsLabelEXT.
- If commandBuffer is a secondary command buffer, there must not be an outstanding vkCmdDebugMarkerBeginEXTcommand recorded to commandBuffer that has not previously been ended by a call to vkCmdDebugMarkerEndEXT.
https://renderdoc.org/vkspec_chunked/chap5.html#commandbuffers
When secondary command buffer(s) are recorded to execute on a primary command buffer, the secondary command buffer inherits no state from the primary command buffer, and all state of the primary command buffer is undefined after an execute secondary command buffer command is recorded
Conclusion
Creation of a GPURenderBundle has the following constraints:
- Debug groups must be well-nested.
- State from the GPUCommandEncoder is not inherited inside the GPURenderBundle. ex.) The following would be invalid:
- beginRenderPass
setPipeline
setBindGroup
executeBounds => ( draw )
endPass
- beginRenderPass
- State in a GPURenderBundle does not persist to the GPUCommandEncoder after it is executed. ex.) If a GPURenderBundle calls
setPipeline
, the pipeline does not persist afterexecuteBundles
. ex.) The following would be invalid:- beginRenderPass
executeBundles => ( setPipeline )
setBindGroup
draw
endPass
- beginRenderPass