summaryrefslogtreecommitdiff
path: root/libs/binder/ProcessState.cpp
diff options
context:
space:
mode:
author wukui1 <wukui1@xiaomi.com> 2020-08-05 20:35:29 +0800
committer Peiyong Lin <lpy@google.com> 2020-08-28 16:34:32 -0700
commit6f3c0bb2727718bcf08cfe9d23f8106eb63cad19 (patch)
tree97b5af4f543a79ac68f29d3f76a0d575287c11f5 /libs/binder/ProcessState.cpp
parent653ae188b00bb34b9ac34a0e67b0f8134d3e33e5 (diff)
[RenderEngine] correct alpha blending func
By default, the GPU composition output is assigned to be premultiplied, the GPU composition output is assigned to coverage blend mode and then other device comp type layers are mixed can't ouput the expected color using current renderEngine blend function. Previously, with premultiplied alpha, the blending function used in the GLES back end is: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); which is essentially: out.rgba = src.rgba * src.rgba + dst.rgba * (1 - src.rgba) Without premultiplied alpha, the blending function is: glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); which is essentially: out.rgba = dst.rgba * (1 - src.rgba) This is not correct. The alpha blending equation should be: out.a = src.a + dst.a * (1 - src.a) out.rgb = ((src.rgb * src.a + dst.rgb * dst.a * (1 - src.a)) / out.a * take coverage blend mode, out.a = src.a + dst.a * (1 - src.a) out.rgb * out.a = (src.rgb * src.a + dst.rgb * dst.a * (1 - src.a) * take premultiplied blend mode, out.a = src.a + dst.a * (1 - src.a) out.rgb = src.rgb + dst.rgb * (1 - src.a) Bug: b/161500635, b/162919900 Test: atest RenderEngineTest Signed-off-by: wukui1 <wukui1@xiaomi.com> Change-Id: I3816b20be077be054df61815765674f526d354cd
Diffstat (limited to 'libs/binder/ProcessState.cpp')
0 files changed, 0 insertions, 0 deletions