From 636afc1877882dc9cf73b49f8a68c73cc418d8cd Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 7 Feb 2017 11:21:05 -0800 Subject: Apply transfer function when rendering with linear textures RGBA16F bitmaps are always encoded in linear space, which means we must apply the opto-electronic transfer function before we can render them in the framebuffer. Since our linear bitmaps are assumed to be scRGB, values can be negative. The OETF is a slightly modified sRGB OETF: sign(x) * OETF_sRGB(abs(x)) This effectively mirrors the OETF over the negative domain. This CL also removes the "optimized" shader generation path. With current compilers, the optimized path doesn't do anything of value and makes ProgramCache difficult to maintain. Shader compilers inline everything and are really good at folding expressions and removing unused code. Bug: 32984164 Test: CtsUiRenderingTestCases Change-Id: Ieb458ad53574e3a8959aa6bccbbd2d1fe203cbc5 --- libs/hwui/Texture.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libs/hwui/Texture.cpp') diff --git a/libs/hwui/Texture.cpp b/libs/hwui/Texture.cpp index f6850a110286..50af9c8cd711 100644 --- a/libs/hwui/Texture.cpp +++ b/libs/hwui/Texture.cpp @@ -48,6 +48,10 @@ static int bytesPerPixel(GLint glFormat) { } } +bool Texture::isLinear() const { + return mInternalFormat == GL_RGBA16F; +} + void Texture::setWrapST(GLenum wrapS, GLenum wrapT, bool bindTexture, bool force) { if (force || wrapS != mWrapS || wrapT != mWrapT) { -- cgit v1.2.3-59-g8ed1b