rebuild(format, width, height, scale, antiAlias, depthStencilFormat) {
    // always release first
    this.release();

    // set defaults in case of bad parameters
    // TODO: report to bug snag
    if (format == null) {
      var errorMsg = `RenderPass: initialized with invalid FORMAT of ${format}, using default cc.Texture2D.PIXEL_FORMAT_RGBA8888`;
      console.warn(errorMsg);
      format = cc.Texture2D.PIXEL_FORMAT_RGBA8888;
    }
    if (width == null || width <= 0) {
      var errorMsg = `RenderPass: initialized with invalid WIDTH dimension of ${width}, using default 100`;
      console.warn(errorMsg);
      width = 100;
    }
    if (height == null || height <= 0) {
      var errorMsg = `RenderPass: initialized with invalid HEIGHT dimension of ${height}, using default 100`;
      console.warn(errorMsg);
      height = 100;
    }
    if (scale == null || scale <= 0) {
      scale = 1;
    }
    if (antiAlias == null) {
      antiAlias = true;
    }

    // appears to be safe to use non power of two textures
    // based on http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences#Non-Power_of_Two_Texture_Support
    // repeat must be CLAMP_TO_EDGE and minification must be NEAREST OR LINEAR
    this.scale = scale;
    this.width = Math.ceil(width * this.scale);
    this.height = Math.ceil(height * this.scale);
    const devicePixelRatio = cc.view.getDevicePixelRatio();
    const textureWidth = Math.ceil(this.width * devicePixelRatio);
    const textureHeight = Math.ceil(this.height * devicePixelRatio);
    this.antiAlias = antiAlias;

    const gl = cc._renderContext;
    const frameBufferLast = gl.getParameter(gl.FRAMEBUFFER_BINDING);
    this.frameBuffer = gl.createFramebuffer();

    this.texture = new cc.Texture2D();
    this.texture.initWithData(null, format, textureWidth, textureHeight, cc.size(textureWidth, textureHeight));
    if (this.antiAlias) {
      this.texture.setAntiAliasTexParameters();
    } else {
      this.texture.setAliasTexParameters();
    }
    this.texture._hasPremultipliedAlpha = true;

    gl.bindFramebuffer(gl.FRAMEBUFFER, this.frameBuffer);
    gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.texture.getName(), 0);

    if (depthStencilFormat != null) {
      this.renderBuffer = gl.createRenderbuffer();
      gl.bindRenderbuffer(gl.RENDERBUFFER, this.renderBuffer);
      // stencil format support appears to be unstable, so we'll force use of depth/stencil for now
      // gl.renderbufferStorage(gl.RENDERBUFFER, depthStencilFormat, this.width, this.height);
      // gl.framebufferRenderbuffer(gl.FRAMEBUFFER, depthStencilFormat === gl.STENCIL_INDEX8 ? gl.STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.renderBuffer);
      gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, this.width, this.height);
      gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.renderBuffer);
    }

    // check framebuffer status
    const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
    switch (status) {
    case gl.FRAMEBUFFER_UNSUPPORTED:
      throw 'RenderPass: Framebuffer is unsupported';
    case gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
      throw 'RenderPass: Framebuffer incomplete attachment';
    case gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
      throw 'RenderPass: Framebuffer incomplete dimensions';
    case gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
      throw 'RenderPass: Framebuffer incomplete missing attachment';
    }

    gl.bindFramebuffer(gl.FRAMEBUFFER, frameBufferLast);

    const quad = this._quad = new cc.V3F_C4B_T2F_Quad();

    quad.tl.vertices.x = 0;
    quad.tl.vertices.y = this.height;
    quad.tl.vertices.z = cc.Node.prototype._vertexZ;
    quad.tl.texCoords.u = 0;
    quad.tl.texCoords.v = 1;
    quad.tl.colors.r = quad.tl.colors.g = quad.tl.colors.b = quad.tl.colors.a = 255;

    quad.bl.vertices.x = 0;
    quad.bl.vertices.y = 0;
    quad.bl.vertices.z = cc.Node.prototype._vertexZ;
    quad.bl.texCoords.u = 0;
    quad.bl.texCoords.v = 0;
    quad.bl.colors.r = quad.bl.colors.g = quad.bl.colors.b = quad.bl.colors.a = 255;

    quad.tr.vertices.x = this.width;
    quad.tr.vertices.y = this.height;
    quad.tr.vertices.z = cc.Node.prototype._vertexZ;
    quad.tr.texCoords.u = 1;
    quad.tr.texCoords.v = 1;
    quad.tr.colors.r = quad.tr.colors.g = quad.tr.colors.b = quad.tr.colors.a = 255;

    quad.br.vertices.x = this.width;
    quad.br.vertices.y = 0;
    quad.br.vertices.z = cc.Node.prototype._vertexZ;
    quad.br.texCoords.u = 1;
    quad.br.texCoords.v = 0;
    quad.br.colors.r = quad.br.colors.g = quad.br.colors.b = quad.br.colors.a = 255;

    this._quadBuffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, this._quadBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, quad.arrayBuffer, gl.STATIC_DRAW);

    // orthographic projection matrix
    this._projMatrix = cc.kmMat4Identity(new cc.kmMat4());
    cc.kmMat4OrthographicProjection(this._projMatrix, 0, this.width, 0, this.height, -1024, 1024);

    // stack/modelview matrix
    this._stackMatrix = cc.kmMat4Identity(new cc.kmMat4());

    // TODO: pass perspective projection/stack matrices are slightly off
    const zeyePass = (this.height / 2.0 / Math.tan(Math.PI / 6.0));
    this._perspectiveProjMatrix = cc.kmMat4Identity(new cc.kmMat4());
    cc.kmMat4PerspectiveProjection(this._perspectiveProjMatrix, 60, this.width / this.height, 0.1, zeyePass * 2);

    this._perspectiveStackMatrix = cc.kmMat4Identity(new cc.kmMat4());
    const eye = cc.kmVec3Fill(null, this.width / 2, this.height / 2, zeyePass);
    const center = cc.kmVec3Fill(null, this.width / 2, this.height / 2, 0.0);
    const up = cc.kmVec3Fill(null, 0.0, 1.0, 0.0);
    cc.kmMat4LookAt(this._perspectiveStackMatrix, eye, center, up);
  }
Rebuild render pass to use new parameters.
@param format
@param width
@param height
@param [scale=1]
@param [antiAlias=true]
@param [depthStencilFormat=null]