public void Setup(RenderTexture rtex) { if (rtex != null) { this.name = rtex.name; // if rtex is 32 bit int / uint format, set output format as bit masks #if UNITY_2019_1_OR_NEWER switch (rtex.graphicsFormat) { case GraphicsFormat.R32_UInt: case GraphicsFormat.R32G32_UInt: case GraphicsFormat.R32G32B32_UInt: case GraphicsFormat.R32G32B32A32_UInt: case GraphicsFormat.R32_SInt: case GraphicsFormat.R32G32_SInt: case GraphicsFormat.R32G32B32_SInt: case GraphicsFormat.R32G32B32A32_SInt: this.outputFormat = rthsOutputFormat.BitMask; break; default: this.outputFormat = rthsOutputFormat.Float; break; } #else switch (rtex.format) { case RenderTextureFormat.RInt: case RenderTextureFormat.RGInt: case RenderTextureFormat.ARGBInt: this.outputFormat = rthsOutputFormat.BitMask; break; default: this.outputFormat = rthsOutputFormat.Float; break; } #endif rthsRenderTargetSetGPUTexture(self, rtex.GetNativeTexturePtr()); } }
[DllImport(Lib.name)] static extern void rthsRenderTargetSetOutputFormat(IntPtr self, rthsOutputFormat fmt);