[RFCv2 6/9] gl-renderer: Add support for blending in linear space.

John Kåre Alsaker john.kare.alsaker at gmail.com
Mon Nov 19 06:23:24 PST 2012


On Mon, Nov 19, 2012 at 9:52 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Sat, 17 Nov 2012 03:23:57 +0100
> John Kåre Alsaker <john.kare.alsaker at gmail.com> wrote:
>
>> This makes compositing gamma correct by assuming all input surfaces are in
>> the sRGB color space. It can be enabled by setting color-managed to true
>> in the compositor section of weston.ini.
>>
>> It's implemented by converting from sRGB gamma using the new CONVERSION_FROM_SRGB
>> shader attribute and drawing the surfaces into a temporary buffer (the
>> indirect rendering introduced in the previous patch). That buffer is then
>> drawed to the framebuffer using the OUTPUT_TO_SRGB shader attribute which
>> converts back into sRGB gamma.
>>
>> Both the temporary buffer and sRGB decode LUT needs atleast 12-bits per
>> channel for flawless results with 8-bit input/output. This is not provided
>> by OpenGL ES 2 by default so desktop OpenGL is required for usable results.
>>
>> It also adds a check to ensure we have enough texture units for the planes
>> and the LUT.
>> ---
>>  src/compositor.c  |   7 ++-
>>  src/compositor.h  |   2 +
>>  src/gl-internal.h |  13 ++++-
>>  src/gl-renderer.c |  45 ++++++++++++---
>>  src/gl-shaders.c  | 169 +++++++++++++++++++++++++++++++++++++++++++++++++++---
>>  5 files changed, 219 insertions(+), 17 deletions(-)
> ...
>> diff --git a/src/gl-renderer.c b/src/gl-renderer.c
>> index b35c5a9..c5b3908 100644
>> --- a/src/gl-renderer.c
>> +++ b/src/gl-renderer.c
> ...
>> @@ -1600,6 +1619,7 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
>>       gr->bgra_format = GL_BGRA;
>>       gr->short_type = GL_UNSIGNED_SHORT;
>>       gr->rgba16_internal_format = GL_RGBA16;
>> +     gr->l16_internal_format = GL_LUMINANCE16;
>>  #else
>>       static const EGLint context_attribs[] = {
>>               EGL_CONTEXT_CLIENT_VERSION, 2,
>> @@ -1610,6 +1630,7 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
>>       gr->bgra_format = GL_BGRA_EXT;
>>       gr->short_type = GL_UNSIGNED_BYTE;
>>       gr->rgba16_internal_format = GL_RGBA;
>> +     gr->l16_internal_format = GL_LUMINANCE;
>>  #endif
>
> You are using a luminance format for a single-channel texture, that
> acts as the lookup table?
I am

>
> Did you consider GL_R formats? I.e. single-channel color formats.
> Luminance is sort of a thing of the past, AFAIU.
So is OpenGL 2.1, which I'm using.

>
>
> Thanks,
> pq


More information about the wayland-devel mailing list