From 852cc068d3951b61a1bd72967abe2550bb0b4c2f Mon Sep 17 00:00:00 2001 From: Deve Date: Sat, 17 Sep 2016 03:46:35 +0200 Subject: [PATCH] Restore SSAO on linux with GLES renderer. --- data/graphical_restrictions.xml | 1 + src/graphics/render.cpp | 2 -- src/graphics/render_lighting.cpp | 5 +++++ src/graphics/rtts.cpp | 23 +++++++++++++---------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/data/graphical_restrictions.xml b/data/graphical_restrictions.xml index 67d0321f8..9d1374e55 100644 --- a/data/graphical_restrictions.xml +++ b/data/graphical_restrictions.xml @@ -30,4 +30,5 @@ + diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 68e2c8cf2..3ef16eefc 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -431,10 +431,8 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po { PROFILER_PUSH_CPU_MARKER("- SSAO", 0xFF, 0xFF, 0x00); ScopedGPUTimer Timer(getGPUTimer(Q_SSAO)); - #if !defined(USE_GLES2) if (UserConfigParams::m_ssao) renderSSAO(); - #endif PROFILER_POP_CPU_MARKER(); } diff --git a/src/graphics/render_lighting.cpp b/src/graphics/render_lighting.cpp index b90b9c9a2..cb5787f18 100644 --- a/src/graphics/render_lighting.cpp +++ b/src/graphics/render_lighting.cpp @@ -527,6 +527,11 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow) // ---------------------------------------------------------------------------- void IrrDriver::renderSSAO() { +#if defined(USE_GLES2) + if (!CVS->isEXTColorBufferFloatUsable()) + return; +#endif + m_rtts->getFBO(FBO_SSAO).bind(); glClearColor(1., 1., 1., 1.); glClear(GL_COLOR_BUFFER_BIT); diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index f0c9bbd94..a6040ab20 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -79,7 +79,6 @@ RTT::RTT(size_t width, size_t height) // All RTTs are currently RGBA16F mostly with stencil. The four tmp RTTs are the same size // as the screen, for use in post-processing. -#if !defined(USE_GLES2) GLint rgba_internal_format = GL_RGBA16F; GLint rgba_format = GL_BGRA; GLint red_internal_format = GL_R16F; @@ -88,15 +87,19 @@ RTT::RTT(size_t width, size_t height) GLint rgb_format = GL_BGR; GLint diffuse_specular_internal_format = GL_R11F_G11F_B10F; GLint type = GL_FLOAT; -#else - GLint rgba_internal_format = GL_RGBA8; - GLint rgba_format = GL_RGBA; - GLint red_internal_format = GL_R8; - GLint red32_internal_format = GL_R8; - GLint red_format = GL_RED; - GLint rgb_format = GL_RGB; - GLint diffuse_specular_internal_format = GL_RGBA8; - GLint type = GL_UNSIGNED_BYTE; + +#if defined(USE_GLES2) + if (!CVS->isEXTColorBufferFloatUsable()) + { + rgba_internal_format = GL_RGBA8; + rgba_format = GL_RGBA; + red_internal_format = GL_R8; + red32_internal_format = GL_R8; + red_format = GL_RED; + rgb_format = GL_RGB; + diffuse_specular_internal_format = GL_RGBA8; + type = GL_UNSIGNED_BYTE; + } #endif RenderTargetTextures[RTT_TMP1] = generateRTT(res, rgba_internal_format, rgba_format, type);