From 40dcea79cfb1c9b1525614a55afe73a2ea878da0 Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sat, 19 Sep 2020 16:41:04 -0300 Subject: [PATCH] [GL3+] sRGB RenderTextures were forced to always on Report by Scorg https://forums.ogre3d.org/viewtopic.php?f=25&t=95996 --- .../include/OgreGL3PlusRenderPassDescriptor.h | 1 + .../src/OgreGL3PlusRenderPassDescriptor.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/RenderSystems/GL3Plus/include/OgreGL3PlusRenderPassDescriptor.h b/RenderSystems/GL3Plus/include/OgreGL3PlusRenderPassDescriptor.h index ca81831154f..7287f96f5c8 100644 --- a/RenderSystems/GL3Plus/include/OgreGL3PlusRenderPassDescriptor.h +++ b/RenderSystems/GL3Plus/include/OgreGL3PlusRenderPassDescriptor.h @@ -64,6 +64,7 @@ namespace Ogre bool mAllClearColoursSetAndIdentical; bool mAnyColourLoadActionsSetToClear; bool mHasRenderWindow; + bool mHasSRGB; GL3PlusFrameBufferDescMap::iterator mSharedFboItor; diff --git a/RenderSystems/GL3Plus/src/OgreGL3PlusRenderPassDescriptor.cpp b/RenderSystems/GL3Plus/src/OgreGL3PlusRenderPassDescriptor.cpp index c993f179c48..c6e7096df79 100644 --- a/RenderSystems/GL3Plus/src/OgreGL3PlusRenderPassDescriptor.cpp +++ b/RenderSystems/GL3Plus/src/OgreGL3PlusRenderPassDescriptor.cpp @@ -44,6 +44,7 @@ namespace Ogre mAllClearColoursSetAndIdentical( false ), mAnyColourLoadActionsSetToClear( false ), mHasRenderWindow( false ), + mHasSRGB( false ), mSharedFboItor( renderSystem->_getFrameBufferDescMap().end() ), mRenderSystem( renderSystem ) { @@ -207,6 +208,7 @@ namespace Ogre } bool needsMsaaResolveFbo = false; + mHasSRGB = false; //Attach colour entries for( size_t i=0; igetPixelFormat() ) ) + mHasSRGB |= true; + if( !mHasRenderWindow && mColour[i].texture->getPixelFormat() != PFG_NULL ) { assert( dynamic_cast( mColour[i].texture ) ); @@ -487,7 +492,17 @@ namespace Ogre OCGE( glDrawBuffers( mNumColourEntries, colourBuffs ) ); } - OCGE( glEnable( GL_FRAMEBUFFER_SRGB ) ); + if( entriesToFlush & RenderPassDescriptor::Colour ) + { + if( mHasSRGB ) + { + OCGE( glEnable( GL_FRAMEBUFFER_SRGB ) ); + } + else + { + OCGE( glDisable( GL_FRAMEBUFFER_SRGB ) ); + } + } const RenderSystemCapabilities *capabilities = mRenderSystem->getCapabilities(); const bool isTiler = capabilities->hasCapability( RSC_IS_TILER );