code: function(parent, cmd, inherit) {
        // copy old state so we don't modify it's internals
        const newCmd = Object.assign({}, parent)
  
        if (!inherit) {
          // clear values are not merged as they are applied only in the parent command
          newCmd.pass = Object.assign({}, parent.pass)
          newCmd.pass.clearColor = undefined
          newCmd.pass.clearDepth = undefined
        }
  
        // overwrite properties from new command
        Object.assign(newCmd, cmd)
  
        // set viewport to FBO sizes when rendering to a texture
        if (!cmd.viewport && cmd.pass && cmd.pass.opts.color) {
          let tex = null
          if (cmd.pass.opts.color[0]) {
            tex = cmd.pass.opts.color[0].texture || cmd.pass.opts.color[0]
          }
          if (cmd.pass.opts.depth) {
            tex = cmd.pass.opts.depth.texture || cmd.pass.opts.depth
          }
          if (tex) {
            newCmd.viewport = [0, 0, tex.width, tex.height]
          }
        }
  
        // merge uniforms
        newCmd.uniforms =
          parent.uniforms || cmd.uniforms
            ? Object.assign({}, parent.uniforms, cmd.uniforms)
            : null
        return newCmd
      }
docs: TODO: i don't like this inherit flag