From b2832d11a60ace74e2c0412573709c576cd0fdbe Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 24 Mar 2023 16:46:42 +0000 Subject: [PATCH] Do manual sRGB conversion on ReadPixels path for pixel history --- renderdoc/driver/gl/gl_pixelhistory.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/renderdoc/driver/gl/gl_pixelhistory.cpp b/renderdoc/driver/gl/gl_pixelhistory.cpp index ec43d5d77..74b6c05b2 100644 --- a/renderdoc/driver/gl/gl_pixelhistory.cpp +++ b/renderdoc/driver/gl/gl_pixelhistory.cpp @@ -24,6 +24,7 @@ #include #include "data/glsl_shaders.h" +#include "maths/formatpacking.h" #include "gl_common.h" #include "gl_driver.h" #include "gl_replay.h" @@ -878,6 +879,9 @@ void readPixelValues(WrappedOpenGL *driver, const GLPixelHistoryResources &resou { driver->glReadPixels(0, 0, GLint(numPixels), 1, eGL_RGBA, eGL_FLOAT, (void *)floatColourValues.data()); + if(IsSRGBFormat(copyFramebuffer.format.colorFormat)) + for(float &f : floatColourValues) + f = ConvertSRGBToLinear(f); } if(copyFramebuffer.dsTextureId != 0 || copyFramebuffer.depthTextureId != 0) {