copy_command_context() function
Creates a copy of an existing command context. This does not create a deep copy of the command list, so modifications in one context will affect all shared contexts. The caller must track reference counting and ensure the commands are freed before destroying the last instance.
Arguments
cmd_ctx
The command_context that will be copied.
Return value
A new command_context with the same state as the original.