summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinpeter <linpeter@google.com>2018-11-01 09:00:16 +0800
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-12-05 00:11:31 +0000
commitffda9590e2daa73e7009e72dca92e0d75a3cc68e (patch)
treeaf9ccdf32653250541fd8fdfc37c4bd745835a1a
parent1af534d60c1b26fabb5d4fe6c1ed58f54dd66b97 (diff)
downloadnative-ffda9590e2daa73e7009e72dca92e0d75a3cc68e.tar.gz
[RenderEngine] Add clamp for texture2D
This patch adds the clamp for texture2D. Make sure the texture output is in range(0.0~1.0). BUG: 117080518 Test: watch Youtube HDR without broken image Change-Id: If6de0e4c6157ef1818df775946db2a0c64a6aa09 (cherry picked from commit ec062c37de8f9684d6b1d9ef5be0fbb419a14f57)
-rw-r--r--services/surfaceflinger/RenderEngine/ProgramCache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/surfaceflinger/RenderEngine/ProgramCache.cpp b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
index 9dc6858566..338d27c2e4 100644
--- a/services/surfaceflinger/RenderEngine/ProgramCache.cpp
+++ b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
@@ -611,7 +611,7 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) {
fs << "void main(void) {" << indent;
if (needs.isTexturing()) {
- fs << "gl_FragColor = texture2D(sampler, outTexCoords);";
+ fs << "gl_FragColor = clamp(texture2D(sampler, outTexCoords), 0.0, 1.0);";
if (needs.isY410BT2020()) {
fs << "gl_FragColor.rgb = convertY410BT2020(gl_FragColor.rgb);";
}