コード例 #1
0
        public void flush(uiPicture picture)
        {
            if (!CanvasShader.isReady())
            {
                return;
            }

            this._reset();
            this._resetRenderTextureId();
            this._resetComputeBuffer();

            this._drawUIPicture(picture, false);

            D.assert(this._layers.Count == 1);
            D.assert(this._layers[0].states.Count == 1);

            var layer = this._currentLayer;

            using (var cmdBuf = new CommandBuffer()) {
                cmdBuf.name = "CommandBufferCanvas";

                this._lastRtID = -1;
                this._drawLayer(layer, cmdBuf);

                // this is necessary for webgl2. not sure why... just to be safe to disable the scissor.
                cmdBuf.DisableScissorRect();

                this._bindComputeBuffer();
                Graphics.ExecuteCommandBuffer(cmdBuf);
            }

            D.assert(this._layers.Count == 0 || (this._layers.Count == 1 && this._layers[0] == this._currentLayer));
            if (this._currentLayer != null)
            {
                this._clearLayer(this._currentLayer);
                ObjectPool <RenderLayer> .release(this._currentLayer);

                this._currentLayer = null;
                this._lastScissor  = null;
                this._layers.Clear();
            }

            AllocDebugger.onFrameEnd();
        }