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-11-28 23:27:50 +0000
commit4356d94c43d8e64e91eb3c294d43480728084bae (patch)
treeaf9ccdf32653250541fd8fdfc37c4bd745835a1a
parent082dae4ab37d2f7a3631d98d24870b2c767182ce (diff)
downloadnative-4356d94c43d8e64e91eb3c294d43480728084bae.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);";
}