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

Commit 4a809a5

Browse files
authored
Merge pull request #771 from Unity-Technologies/fix_mali_color_grading_on_gles2
Fixed case 1127107. No more banding with Color grading on ES2 on Mali!
2 parents 80a6939 + a784e0b commit 4a809a5

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this package will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [2.1.5] - 2019-xx-xx
8+
9+
### Fixed
10+
- LDR Color grading in gamma mode no longer produces banding artifacts on Mali GPUs on OpenGL ES2.
11+
712
## [2.1.4] - 2019-02-27
813

914
### Fixed

PostProcessing/Runtime/Effects/ColorGrading.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
using UnityEngine.Experimental.Rendering;
4+
35
namespace UnityEngine.Rendering.PostProcessing
46
{
57
/// <summary>
@@ -779,19 +781,25 @@ Texture2D GetCurveTexture(bool hdr)
779781
return m_GradingCurves;
780782
}
781783

784+
static bool IsRenderTextureFormatSupportedForLinearFiltering(RenderTextureFormat format)
785+
{
786+
var gFormat = GraphicsFormatUtility.GetGraphicsFormat(format, RenderTextureReadWrite.Linear);
787+
return SystemInfo.IsFormatSupported(gFormat, FormatUsage.Linear);
788+
}
789+
782790
static RenderTextureFormat GetLutFormat()
783791
{
784792
// Use ARGBHalf if possible, fallback on ARGB2101010 and ARGB32 otherwise
785793
var format = RenderTextureFormat.ARGBHalf;
786794

787-
if (!format.IsSupported())
795+
if (!IsRenderTextureFormatSupportedForLinearFiltering(format))
788796
{
789797
format = RenderTextureFormat.ARGB2101010;
790798

791799
// Note that using a log lut in ARGB32 is a *very* bad idea but we need it for
792800
// compatibility reasons (else if a platform doesn't support one of the previous
793801
// format it'll output a black screen, or worse will segfault on the user).
794-
if (!format.IsSupported())
802+
if (!IsRenderTextureFormatSupportedForLinearFiltering(format))
795803
format = RenderTextureFormat.ARGB32;
796804
}
797805

0 commit comments

Comments
 (0)