static RenderTextureDescriptor CreateRenderTextureDescriptor(Camera camera, float renderScale, bool isStereoEnabled, bool isHdrEnabled, int msaaSamples) { RenderTextureDescriptor desc; RenderTextureFormat renderTextureFormatDefault = RenderTextureFormat.Default; if (isStereoEnabled) { desc = XRGraphics.eyeTextureDesc; renderTextureFormatDefault = desc.colorFormat; } else { desc = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight); desc.width = (int)((float)desc.width * renderScale); desc.height = (int)((float)desc.height * renderScale); } // TODO: when preserve framebuffer alpha is enabled we can't use RGB111110Float format. bool useRGB111110 = Application.isMobilePlatform && RenderingUtils.SupportsRenderTextureFormat(RenderTextureFormat.RGB111110Float); RenderTextureFormat hdrFormat = (useRGB111110) ? RenderTextureFormat.RGB111110Float : RenderTextureFormat.DefaultHDR; desc.colorFormat = isHdrEnabled ? hdrFormat : renderTextureFormatDefault; desc.depthBufferBits = 32; desc.enableRandomWrite = false; desc.sRGB = (QualitySettings.activeColorSpace == ColorSpace.Linear); desc.msaaSamples = msaaSamples; desc.bindMS = false; desc.useDynamicScale = camera.allowDynamicResolution; return(desc); }
public void Setup(RenderTextureDescriptor baseDescriptor) { m_RenderTextureDescriptor = baseDescriptor; m_RenderTextureDescriptor.depthBufferBits = 0; m_RenderTextureDescriptor.colorFormat = RenderingUtils.SupportsRenderTextureFormat(RenderTextureFormat.R8) ? RenderTextureFormat.R8 : RenderTextureFormat.ARGB32; }
static ShadowUtils() { m_ShadowmapFormat = RenderingUtils.SupportsRenderTextureFormat(RenderTextureFormat.Shadowmap) ? RenderTextureFormat.Shadowmap : RenderTextureFormat.Depth; m_ForceShadowPointSampling = SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal && GraphicsSettings.HasShaderDefine(Graphics.activeTier, BuiltinShaderDefine.UNITY_METAL_SHADOWS_USE_POINT_FILTERING); }