[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)
diff --git a/services/surfaceflinger/RenderEngine/ProgramCache.cpp b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
index 9dc6858..338d27c 100644
--- a/services/surfaceflinger/RenderEngine/ProgramCache.cpp
+++ b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
@@ -611,7 +611,7 @@
 
     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);";
         }