Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 301927a

Browse files
committed
Fixed color grading issues on low-end mobiles at the expense of visual quality
1 parent 3fc16cd commit 301927a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

PostProcessing/Runtime/Components/ColorGradingComponent.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,19 @@ public static void CalculateSlopePowerOffset(Color slope, Color power, Color off
223223
outOffset = GetOffsetValue(offset);
224224
}
225225

226+
TextureFormat GetCurveFormat()
227+
{
228+
if (SystemInfo.SupportsTextureFormat(TextureFormat.RGBAHalf))
229+
return TextureFormat.RGBAHalf;
230+
231+
return TextureFormat.RGBA32;
232+
}
233+
226234
Texture2D GetCurveTexture()
227235
{
228236
if (m_GradingCurves == null)
229237
{
230-
m_GradingCurves = new Texture2D(k_CurvePrecision, 2, TextureFormat.RGBAHalf, false, true)
238+
m_GradingCurves = new Texture2D(k_CurvePrecision, 2, GetCurveFormat(), false, true)
231239
{
232240
name = "Internal Curves Texture",
233241
hideFlags = HideFlags.DontSave,
@@ -271,6 +279,14 @@ bool IsLogLutValid(RenderTexture lut)
271279
return lut != null && lut.IsCreated() && lut.height == k_InternalLogLutSize;
272280
}
273281

282+
RenderTextureFormat GetLutFormat()
283+
{
284+
if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf))
285+
return RenderTextureFormat.ARGBHalf;
286+
287+
return RenderTextureFormat.ARGB32;
288+
}
289+
274290
void GenerateLut()
275291
{
276292
var settings = model.settings;
@@ -279,7 +295,7 @@ void GenerateLut()
279295
{
280296
GraphicsUtils.Destroy(model.bakedLut);
281297

282-
model.bakedLut = new RenderTexture(k_InternalLogLutSize * k_InternalLogLutSize, k_InternalLogLutSize, 0, RenderTextureFormat.ARGBHalf)
298+
model.bakedLut = new RenderTexture(k_InternalLogLutSize * k_InternalLogLutSize, k_InternalLogLutSize, 0, GetLutFormat())
283299
{
284300
name = "Color Grading Log LUT",
285301
hideFlags = HideFlags.DontSave,

0 commit comments

Comments
 (0)