This repository has been archived on 2024-06-19. You can view files and clone it, but cannot push or open issues or pull requests.
evermillion/Assets/Table and chair/Standard Assets/Effects/CinematicEffects(BETA)/Common/ImageEffectHelper.cs
2024-06-05 11:10:54 +08:00

44 lines
1.3 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace UnityStandardAssets.CinematicEffects
{
public static class ImageEffectHelper
{
public static bool IsSupported(Shader s, bool needDepth, bool needHdr, MonoBehaviour effect)
{
if (s == null || !s.isSupported)
{
Debug.LogWarningFormat("Missing shader for image effect {0}", effect);
return false;
}
if (!SystemInfo.supportsImageEffects || !SystemInfo.supportsRenderTextures)
return false;
if (needDepth && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
return false;
if (needHdr && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf))
return false;
return true;
}
public static Material CheckShaderAndCreateMaterial(Shader s)
{
if (s == null || !s.isSupported)
return null;
var material = new Material(s);
material.hideFlags = HideFlags.DontSave;
return material;
}
public static bool supportsDX11
{
get { return SystemInfo.graphicsShaderLevel >= 50 && SystemInfo.supportsComputeShaders; }
}
}
}