mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 23:36:44 +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)
|
#if defined(Q_OS_ANDROID)
|
||||||
return _linearToSRGBPipeline;
|
return _linearToSRGBPipeline;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef USE_GLES
|
|
||||||
return _SRGBToLinearPipeline;
|
|
||||||
#else
|
|
||||||
return _drawTexturePipeline;
|
return _drawTexturePipeline;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() {
|
void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() {
|
||||||
|
|
|
@ -642,7 +642,7 @@ void OpenGLDisplayPlugin::compositeScene() {
|
||||||
batch.setStateScissorRect(ivec4(uvec2(), _compositeFramebuffer->getSize()));
|
batch.setStateScissorRect(ivec4(uvec2(), _compositeFramebuffer->getSize()));
|
||||||
batch.resetViewTransform();
|
batch.resetViewTransform();
|
||||||
batch.setProjectionTransform(mat4());
|
batch.setProjectionTransform(mat4());
|
||||||
batch.setPipeline(getCompositeScenePipeline());
|
batch.setPipeline(_drawTexturePipeline);
|
||||||
batch.setResourceTexture(0, _currentFrame->framebuffer->getRenderBuffer(0));
|
batch.setResourceTexture(0, _currentFrame->framebuffer->getRenderBuffer(0));
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
});
|
});
|
||||||
|
@ -964,7 +964,3 @@ gpu::PipelinePointer OpenGLDisplayPlugin::getRenderTexturePipeline() {
|
||||||
return _drawTexturePipeline;
|
return _drawTexturePipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::PipelinePointer OpenGLDisplayPlugin::getCompositeScenePipeline() {
|
|
||||||
return _drawTexturePipeline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,6 @@ protected:
|
||||||
float _compositeHUDAlpha{ 1.0f };
|
float _compositeHUDAlpha{ 1.0f };
|
||||||
|
|
||||||
virtual gpu::PipelinePointer getRenderTexturePipeline();
|
virtual gpu::PipelinePointer getRenderTexturePipeline();
|
||||||
virtual gpu::PipelinePointer getCompositeScenePipeline();
|
|
||||||
|
|
||||||
struct CursorData {
|
struct CursorData {
|
||||||
QImage image;
|
QImage image;
|
||||||
|
|
|
@ -174,6 +174,10 @@ float HmdDisplayPlugin::getLeftCenterPixel() const {
|
||||||
return leftCenterPixel;
|
return leftCenterPixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gpu::PipelinePointer HmdDisplayPlugin::getRenderTexturePipeline() {
|
||||||
|
return _drawTexturePipeline;
|
||||||
|
}
|
||||||
|
|
||||||
void HmdDisplayPlugin::internalPresent() {
|
void HmdDisplayPlugin::internalPresent() {
|
||||||
PROFILE_RANGE_EX(render, __FUNCTION__, 0xff00ff00, (uint64_t)presentCount())
|
PROFILE_RANGE_EX(render, __FUNCTION__, 0xff00ff00, (uint64_t)presentCount())
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ struct ToneMappingParams {
|
||||||
ivec4 _toneCurve_s0_s1_s2;
|
ivec4 _toneCurve_s0_s1_s2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const float GAMMA_22 = 2.2;
|
||||||
const float INV_GAMMA_22 = 1.0 / 2.2;
|
const float INV_GAMMA_22 = 1.0 / 2.2;
|
||||||
const int ToneCurveNone = 0;
|
const int ToneCurveNone = 0;
|
||||||
const int ToneCurveGamma22 = 1;
|
const int ToneCurveGamma22 = 1;
|
||||||
|
@ -55,9 +56,17 @@ void main(void) {
|
||||||
} else if (toneCurve == ToneCurveReinhard) {
|
} else if (toneCurve == ToneCurveReinhard) {
|
||||||
tonedColor = srcColor/(1.0 + srcColor);
|
tonedColor = srcColor/(1.0 + srcColor);
|
||||||
tonedColor = pow(tonedColor, vec3(INV_GAMMA_22));
|
tonedColor = pow(tonedColor, vec3(INV_GAMMA_22));
|
||||||
} else if (toneCurve == ToneCurveGamma22) {
|
} else if (toneCurve == ToneCurveNone) {
|
||||||
tonedColor = pow(srcColor, vec3(INV_GAMMA_22));
|
// For debugging purposes, we may want to see what the colors look like before the automatic OpenGL
|
||||||
} // else None toned = src
|
// 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);
|
outFragColor = vec4(tonedColor, 1.0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue