mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 21:52:58 +02:00
removed extraneous conversion to SRGB and back during deferred rendering
This commit is contained in:
parent
06bb09ff58
commit
6f5b37ec87
5 changed files with 17 additions and 15 deletions
|
@ -113,14 +113,8 @@ gpu::PipelinePointer Basic2DWindowOpenGLDisplayPlugin::getRenderTexturePipeline(
|
|||
#if defined(Q_OS_ANDROID)
|
||||
return _linearToSRGBPipeline;
|
||||
#else
|
||||
|
||||
#ifndef USE_GLES
|
||||
return _SRGBToLinearPipeline;
|
||||
#else
|
||||
return _drawTexturePipeline;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() {
|
||||
|
|
|
@ -642,7 +642,7 @@ void OpenGLDisplayPlugin::compositeScene() {
|
|||
batch.setStateScissorRect(ivec4(uvec2(), _compositeFramebuffer->getSize()));
|
||||
batch.resetViewTransform();
|
||||
batch.setProjectionTransform(mat4());
|
||||
batch.setPipeline(getCompositeScenePipeline());
|
||||
batch.setPipeline(_drawTexturePipeline);
|
||||
batch.setResourceTexture(0, _currentFrame->framebuffer->getRenderBuffer(0));
|
||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
});
|
||||
|
@ -964,7 +964,3 @@ gpu::PipelinePointer OpenGLDisplayPlugin::getRenderTexturePipeline() {
|
|||
return _drawTexturePipeline;
|
||||
}
|
||||
|
||||
gpu::PipelinePointer OpenGLDisplayPlugin::getCompositeScenePipeline() {
|
||||
return _drawTexturePipeline;
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,6 @@ protected:
|
|||
float _compositeHUDAlpha{ 1.0f };
|
||||
|
||||
virtual gpu::PipelinePointer getRenderTexturePipeline();
|
||||
virtual gpu::PipelinePointer getCompositeScenePipeline();
|
||||
|
||||
struct CursorData {
|
||||
QImage image;
|
||||
|
|
|
@ -174,6 +174,10 @@ float HmdDisplayPlugin::getLeftCenterPixel() const {
|
|||
return leftCenterPixel;
|
||||
}
|
||||
|
||||
gpu::PipelinePointer HmdDisplayPlugin::getRenderTexturePipeline() {
|
||||
return _drawTexturePipeline;
|
||||
}
|
||||
|
||||
void HmdDisplayPlugin::internalPresent() {
|
||||
PROFILE_RANGE_EX(render, __FUNCTION__, 0xff00ff00, (uint64_t)presentCount())
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ struct ToneMappingParams {
|
|||
ivec4 _toneCurve_s0_s1_s2;
|
||||
};
|
||||
|
||||
const float GAMMA_22 = 2.2;
|
||||
const float INV_GAMMA_22 = 1.0 / 2.2;
|
||||
const int ToneCurveNone = 0;
|
||||
const int ToneCurveGamma22 = 1;
|
||||
|
@ -55,9 +56,17 @@ void main(void) {
|
|||
} else if (toneCurve == ToneCurveReinhard) {
|
||||
tonedColor = srcColor/(1.0 + srcColor);
|
||||
tonedColor = pow(tonedColor, vec3(INV_GAMMA_22));
|
||||
} else if (toneCurve == ToneCurveGamma22) {
|
||||
tonedColor = pow(srcColor, vec3(INV_GAMMA_22));
|
||||
} // else None toned = src
|
||||
} else if (toneCurve == ToneCurveNone) {
|
||||
// For debugging purposes, we may want to see what the colors look like before the automatic OpenGL
|
||||
// conversion mentioned above, so we undo it here
|
||||
tonedColor = pow(srcColor, vec3(GAMMA_22));
|
||||
} else {
|
||||
// toneCurve == ToneCurveGamma22
|
||||
// We use glEnable(GL_FRAMEBUFFER_SRGB), which automatically converts textures from RGB to SRGB
|
||||
// when writing from an RGB framebuffer to an SRGB framebuffer (note that it doesn't do anything
|
||||
// when writing from an SRGB framebuffer to an RGB framebuffer).
|
||||
// Since the conversion happens automatically, we don't need to do anything in this shader
|
||||
}
|
||||
|
||||
outFragColor = vec4(tonedColor, 1.0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue