Gamma Correction unavoidable

https://gitlab.kitware.com/vtk/vtk/-/issues/19849

In https://github.com/Kitware/VTK/blob/master/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx,

void main() { float gamma = 2.2;

// for each sample in the multi sample buffer...
ivec2 itexcoords = ivec2(floor(textureSize(tex) * texCoord));
vec3 accumulate = vec3(0.0,0.0,0.0);
float alpha = 0.0;

for (int i = 0; i < samplecount; i++)
{
  vec4 sampleValue = texelFetch(tex, itexcoords, i);
  // apply gamma correction and sum
  accumulate += pow(sampleValue.rgb, vec3(gamma));
  alpha += sampleValue.a;
}

// divide and reverse gamma correction
accumulate /= float(samplecount);
gl_FragData[0] = vec4(pow(accumulate, vec3(1.0/gamma)), alpha/float(samplecount));

}

is done if MSAA ON and regardless of SRGB How do I turn it off? I guess there is no way,

Can anyone fix it to do gamma correction only for SRGB?

It appears that this may be a bug. It seems that when MultiSamples is enabled, the framebuffer color attachment is assumed to be in sRGB format. @killer3d, do you have a test case that confirms this? That would be helpful in validating this assumption and addressing the issue.

The test is very simple, By default SRGB is false on window, so even with the default settings of VTK, it always does Gamma correction in resolve shader.