diff options
author | 2017-02-07 11:21:05 -0800 | |
---|---|---|
committer | 2017-02-07 22:30:34 +0000 | |
commit | 636afc1877882dc9cf73b49f8a68c73cc418d8cd (patch) | |
tree | 4ae936ca5f5150b22a29b0be632be95354bbb749 /libs/hwui/Program.h | |
parent | 9fe7e16399aa9739b63ce9add1d04fd8ef00678f (diff) |
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
Diffstat (limited to 'libs/hwui/Program.h')
-rw-r--r-- | libs/hwui/Program.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h index e70982f5444a..5c8f8e93fa3d 100644 --- a/libs/hwui/Program.h +++ b/libs/hwui/Program.h @@ -87,6 +87,7 @@ namespace uirenderer { #define PROGRAM_HAS_ROUND_RECT_CLIP 43 #define PROGRAM_HAS_GAMMA_CORRECTION 44 +#define PROGRAM_HAS_LINEAR_TEXTURE 45 /////////////////////////////////////////////////////////////////////////////// // Types @@ -162,7 +163,10 @@ struct ProgramDescription { bool hasDebugHighlight; bool hasRoundRectClip; + // Extra gamma correction used for text bool hasGammaCorrection; + // Set when sampling an image in linear space + bool hasLinearTexture; /** * Resets this description. All fields are reset back to the default @@ -205,6 +209,7 @@ struct ProgramDescription { hasRoundRectClip = false; hasGammaCorrection = false; + hasLinearTexture = false; } /** @@ -275,6 +280,7 @@ struct ProgramDescription { if (hasDebugHighlight) key |= programid(0x1) << PROGRAM_HAS_DEBUG_HIGHLIGHT; if (hasRoundRectClip) key |= programid(0x1) << PROGRAM_HAS_ROUND_RECT_CLIP; if (hasGammaCorrection) key |= programid(0x1) << PROGRAM_HAS_GAMMA_CORRECTION; + if (hasLinearTexture) key |= programid(0x1) << PROGRAM_HAS_LINEAR_TEXTURE; return key; } |