code: function(cmd) {
        const state = this.state
  
        if (this.debugMode)
          log('apply', cmd.name || cmd.id, {
            cmd: cmd,
            state: JSON.parse(JSON.stringify(state))
          })
  
        this.checkError()
  
        if (cmd.scissor) {
          if (cmd.scissor !== state.scissor) {
            state.scissor = cmd.scissor
            gl.enable(gl.SCISSOR_TEST)
            gl.scissor(
              state.scissor[0],
              state.scissor[1],
              state.scissor[2],
              state.scissor[3]
            )
          }
        } else {
          if (cmd.scissor !== state.scissor) {
            state.scissor = cmd.scissor
            gl.disable(gl.SCISSOR_TEST)
          }
        }
  
        if (cmd.pass) this.applyPass(cmd.pass)
        if (cmd.pipeline) this.applyPipeline(cmd.pipeline)
        if (cmd.uniforms) this.applyUniforms(cmd.uniforms)
  
        if (cmd.viewport) {
          if (cmd.viewport !== state.viewport) {
            state.viewport = cmd.viewport
            gl.viewport(
              state.viewport[0],
              state.viewport[1],
              state.viewport[2],
              state.viewport[3]
            )
          }
        }
  
        if (cmd.attributes) {
          this.drawVertexData(cmd)
        }
      }
docs: TODO: switching to lightweight resources would allow to just clone state and use commands as state modifiers?