protected virtual TextureDimension GetTempTextureDimension() => rtSettings.GetTextureDimension(graph);
protected bool UpdateTempRenderTexture(ref CustomRenderTexture target, bool hasMips = false, bool autoGenerateMips = false) { if (graph.outputTexture == null) { return(false); } int outputWidth = rtSettings.GetWidth(graph); int outputHeight = rtSettings.GetHeight(graph); int outputDepth = rtSettings.GetDepth(graph); GraphicsFormat targetFormat = rtSettings.GetGraphicsFormat(graph); TextureDimension dimension = rtSettings.GetTextureDimension(graph); if (dimension == TextureDimension.Cube) { outputHeight = outputDepth = outputWidth; // we only use the width for cubemaps } if (targetFormat == GraphicsFormat.None) { targetFormat = graph.outputTexture.graphicsFormat; } if (dimension == TextureDimension.None) { dimension = TextureDimension.Tex2D; } if (target == null) { target = new CustomRenderTexture(outputWidth, outputHeight, targetFormat) { volumeDepth = Math.Max(1, outputDepth), dimension = dimension, name = $"Mixture Temp {name}", updateMode = CustomRenderTextureUpdateMode.OnDemand, doubleBuffered = rtSettings.doubleBuffered, wrapMode = rtSettings.wrapMode, filterMode = rtSettings.filterMode, useMipMap = hasMips, autoGenerateMips = autoGenerateMips, }; target.Create(); return(true); } // TODO: check if format is supported by current system // Warning: here we use directly the settings from the if (target.width != outputWidth || target.height != outputHeight || target.graphicsFormat != targetFormat || target.dimension != dimension || target.volumeDepth != outputDepth || target.filterMode != graph.outputTexture.filterMode || target.doubleBuffered != rtSettings.doubleBuffered || target.wrapMode != rtSettings.wrapMode || target.filterMode != rtSettings.filterMode || target.useMipMap != hasMips || target.autoGenerateMips != autoGenerateMips) { target.Release(); target.width = Math.Max(1, outputWidth); target.height = Math.Max(1, outputHeight); target.graphicsFormat = (GraphicsFormat)targetFormat; target.dimension = (TextureDimension)dimension; target.volumeDepth = outputDepth; target.doubleBuffered = rtSettings.doubleBuffered; target.wrapMode = rtSettings.wrapMode; target.filterMode = rtSettings.filterMode; target.useMipMap = hasMips; target.autoGenerateMips = autoGenerateMips; target.Create(); } return(false); }