You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

using UnityEngine;
namespace UltraCombos
{
public static class ImageEffectHelper
{
public static bool IsSupported(Shader s, bool needDepth, bool needHdr, MonoBehaviour effect)
{
if (s == null || !s.isSupported)
{
Debug.Log("shader is: " + s);
Debug.LogWarningFormat("Missing shader for image effect {0}", effect);
return false;
}
if (!SystemInfo.supportsImageEffects)
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;
}
}
}