Esempio n. 1
0
        protected void ApplyComputeShader(RenderTexture target)
        {
            if (this._ShaderWeights == null)
            {
                this._ShaderWeights = new ComputeBuffer(4, 16);
                this._ShaderWeights.SetData(new Color[]
                {
                    new Color(0.324f, 0.324f, 0.324f, 1f),
                    new Color(0.232f, 0.232f, 0.232f, 1f),
                    new Color(0.0855f, 0.0855f, 0.0855f, 1f),
                    new Color(0.0205f, 0.0205f, 0.0205f, 1f)
                });
            }
            int width = target.width;
            int num   = (width != 128) ? ((width != 256) ? (this._ComputeShaderKernelIndex + 4) : (this._ComputeShaderKernelIndex + 2)) : this._ComputeShaderKernelIndex;
            TemporaryRenderTexture temporary = RenderTexturesCache.GetTemporary(target.width, target.height, 0, target.format, true, true, false);

            this._BlurComputeShader.SetBuffer(num, "weights", this._ShaderWeights);
            this._BlurComputeShader.SetTexture(num, "_MainTex", target);
            this._BlurComputeShader.SetTexture(num, "_Output", temporary);
            this._BlurComputeShader.Dispatch(num, 1, target.height, 1);
            num++;
            this._BlurComputeShader.SetBuffer(num, "weights", this._ShaderWeights);
            this._BlurComputeShader.SetTexture(num, "_MainTex", temporary);
            this._BlurComputeShader.SetTexture(num, "_Output", target);
            this._BlurComputeShader.Dispatch(num, target.width, 1, 1);
            temporary.Dispose();
        }
Esempio n. 2
0
 public static TemporaryRenderTexture GetTemporary(int width, int height, int depthBuffer, RenderTextureFormat format, bool linear, bool uav, bool mipMaps = false)
 {
     return(RenderTexturesCache.GetCache(width, height, depthBuffer, format, linear, uav, mipMaps).GetTemporary());
 }
Esempio n. 3
0
 internal TemporaryRenderTexture(RenderTexturesCache renderTexturesCache)
 {
     this._Cache         = renderTexturesCache;
     this._RenderTexture = renderTexturesCache.GetTemporaryDirect();
 }
Esempio n. 4
0
        private void RetrieveRenderTexturesSet()
        {
            RenderTextureFormat format = (!this._TwoChannels) ? ((!this._HighPrecision) ? RenderTextureFormat.RGHalf : RenderTextureFormat.RGFloat) : ((!this._HighPrecision) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGBFloat);

            this._RenderTexturesSet = RenderTexturesCache.GetCache(this._Resolution << 1, this._Resolution << 1, 0, format, true, this._UsesUav, false);
        }