Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GL_FRAMEBUFFER_SRGB and Srgba8 vs Rgba8 render target #992

Closed
norru opened this issue Jun 12, 2016 · 4 comments
Closed

GL_FRAMEBUFFER_SRGB and Srgba8 vs Rgba8 render target #992

norru opened this issue Jun 12, 2016 · 4 comments

Comments

@norru
Copy link

norru commented Jun 12, 2016

I'm working on my toy project, for which I'm using a simple HDR pipeline. All the rendering and postprocessing is linear and I'm using FP16 render targets, until the tonemapping step, when I resolve the framebuffer to Rgba8.

At some point I realized I was missing the gamma conversion step - so I added it to my tone mapping shader.

When I got unexpected results, I guessed it was because the graphics driver was doing the conversion for me automatically. Digging deeper, it turns out it didn't but I could turn the feature on by rendering to a Srgba8 framebuffer.

I got the same results as Rgba8. Doing some investigation, I found that in order for OpenGL backend to to do so, GL_FRAMEBUFFER_SRGB must be enabled (together with setting the render target's format to Srgba8).

GL_FRAMEBUFFER_SRGB doesn't turn out from any search in gfx-rs. Is this a bug?

@kvark
Copy link
Member

kvark commented Jun 13, 2016

It is enabled by default. Our examples are mostly gamma correct, last time I checked.
Here is a piece from src/backend/gl/lib.rs:

        if caps.srgb_color_supported {
            unsafe {
                gl.Enable(gl::FRAMEBUFFER_SRGB);
            }
        }

@norru
Copy link
Author

norru commented Jun 13, 2016

Ok, I've missed that bit. Should I switch to Srgba8 then? At a first glance, it does not make any difference (but perhaps I need to check twice). I'm also assuming this doesn't apply to FP16 render targets.

@kvark
Copy link
Member

kvark commented Jun 13, 2016

Yes, that should do it.

On Jun 13, 2016, at 8:08, Nico Orrù [email protected] wrote:

Ok, I've missed that bit. Should I switch to Srgba8 then?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@norru norru closed this as completed Jun 13, 2016
@norru
Copy link
Author

norru commented Jun 13, 2016

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants