mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
gpu/internal/opengl: [OpenGL] respect render target when emulating sRGB
Before this change, the sRGB emulation target would always be the current framebuffer. Now it's the render target passed to BeginFrame. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -35,7 +35,8 @@ type Backend struct {
|
|||||||
srgbaTriple textureTriple
|
srgbaTriple textureTriple
|
||||||
storage [storageBindings]*buffer
|
storage [storageBindings]*buffer
|
||||||
|
|
||||||
sRGBFBO *SRGBFBO
|
outputFBO gl.Framebuffer
|
||||||
|
sRGBFBO *SRGBFBO
|
||||||
|
|
||||||
// vertArray is bound during a frame. We don't need it, but
|
// vertArray is bound during a frame. We don't need it, but
|
||||||
// core desktop OpenGL profile 3.3 requires some array bound.
|
// core desktop OpenGL profile 3.3 requires some array bound.
|
||||||
@@ -234,6 +235,7 @@ func (b *Backend) BeginFrame(target driver.RenderTarget, clear bool, viewport im
|
|||||||
panic(fmt.Errorf("opengl: invalid render target type: %T", target))
|
panic(fmt.Errorf("opengl: invalid render target type: %T", target))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
b.outputFBO = renderFBO
|
||||||
b.glstate.bindFramebuffer(b.funcs, gl.FRAMEBUFFER, renderFBO)
|
b.glstate.bindFramebuffer(b.funcs, gl.FRAMEBUFFER, renderFBO)
|
||||||
if b.gles {
|
if b.gles {
|
||||||
// If the output framebuffer is not in the sRGB colorspace already, emulate it.
|
// If the output framebuffer is not in the sRGB colorspace already, emulate it.
|
||||||
@@ -275,7 +277,7 @@ func (b *Backend) BeginFrame(target driver.RenderTarget, clear bool, viewport im
|
|||||||
|
|
||||||
func (b *Backend) EndFrame() {
|
func (b *Backend) EndFrame() {
|
||||||
if b.sRGBFBO != nil {
|
if b.sRGBFBO != nil {
|
||||||
b.glstate.bindFramebuffer(b.funcs, gl.FRAMEBUFFER, b.savedState.drawFBO)
|
b.glstate.bindFramebuffer(b.funcs, gl.FRAMEBUFFER, b.outputFBO)
|
||||||
if b.clear {
|
if b.clear {
|
||||||
b.SetBlend(false)
|
b.SetBlend(false)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user