Remove all unused / unstable opengl-related code

This commit is contained in:
Benau
2018-01-12 13:04:40 +08:00
parent 9ccb34c2a1
commit 6071d2f983
17 changed files with 18 additions and 526 deletions

View File

@@ -588,18 +588,6 @@ namespace UserConfigParams
PARAM_PREFIX BoolUserConfigParam m_dof
PARAM_DEFAULT(BoolUserConfigParam(false, "enable_dof",
&m_video_group, "Enable Depth of Field"));
PARAM_PREFIX BoolUserConfigParam m_gi
PARAM_DEFAULT(BoolUserConfigParam(false, "enable_gi",
&m_video_group, "Enable Global Illumination"));
PARAM_PREFIX BoolUserConfigParam m_azdo
PARAM_DEFAULT(BoolUserConfigParam(false, "enable_azdo",
&m_video_group, "Enable 'Approaching Zero Driver Overhead' mode (very experimental !)"));
PARAM_PREFIX BoolUserConfigParam m_sdsm
PARAM_DEFAULT(BoolUserConfigParam(false, "enable_sdsm",
&m_video_group, "Enable Sampled Distribued Shadow Map (buggy atm)"));
PARAM_PREFIX BoolUserConfigParam m_esm
PARAM_DEFAULT(BoolUserConfigParam(false, "enable_esm",
&m_video_group, "Enable Exponential Shadow Map (better but slower)"));
PARAM_PREFIX BoolUserConfigParam m_old_driver_popup
PARAM_DEFAULT(BoolUserConfigParam(true, "old_driver_popup",
&m_video_group, "Determines if popup message about too old drivers should be displayed."));

View File

@@ -50,7 +50,6 @@ void CentralVideoSettings::init()
hasTextureFilterAnisotropic = false;
hasTextureSwizzle = false;
hasPixelBufferObject = false;
hasSRGBFramebuffer = false;
hasSamplerObjects = false;
hasVertexType2101010Rev = false;
hasInstancedArrays = false;
@@ -59,9 +58,6 @@ void CentralVideoSettings::init()
hasBGRA = false;
hasColorBufferFloat = false;
#endif
m_GI_has_artifact = false;
m_need_rh_workaround = false;
m_need_vertex_id_workaround = false;
// Call to glGetIntegerv should not be made if --no-graphics is used
@@ -202,18 +198,6 @@ void CentralVideoSettings::init()
hasInstancedArrays = true;
Log::info("GLDriver", "ARB Instanced Arrays Present");
}
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_GI))
{
m_GI_has_artifact = true;
}
// Specific disablement
if (strstr((const char *)glGetString(GL_VENDOR), "NVIDIA") != NULL)
{
// Fix for Nvidia and instanced RH
// Compiler crashes with a big loop in RH or GI shaders
m_need_rh_workaround = true;
}
// Check all extensions required by SP
m_supports_sp = isARBInstancedArraysUsable() &&
@@ -306,11 +290,6 @@ bool CentralVideoSettings::isGLSL() const
return m_glsl;
}
bool CentralVideoSettings::needRHWorkaround() const
{
return m_need_rh_workaround;
}
bool CentralVideoSettings::needsVertexIdWorkaround() const
{
return m_need_vertex_id_workaround;
@@ -393,11 +372,6 @@ bool CentralVideoSettings::isEXTTextureFilterAnisotropicUsable() const
return hasTextureFilterAnisotropic;
}
bool CentralVideoSettings::isARBSRGBFramebufferUsable() const
{
return false;
}
#if defined(USE_GLES2)
bool CentralVideoSettings::isEXTTextureFormatBGRA8888Usable() const
{
@@ -410,11 +384,6 @@ bool CentralVideoSettings::isEXTColorBufferFloatUsable() const
}
#endif
bool CentralVideoSettings::supportsGlobalIllumination() const
{
return false;
}
bool CentralVideoSettings::supportsComputeShadersFiltering() const
{
return isARBBufferStorageUsable() && isARBImageLoadStoreUsable() && isARBComputeShaderUsable() && isARBArraysOfArraysUsable();
@@ -430,28 +399,11 @@ bool CentralVideoSettings::isShadowEnabled() const
return UserConfigParams::m_shadows_resolution > 0;
}
bool CentralVideoSettings::isGlobalIlluminationEnabled() const
{
return false;
}
bool CentralVideoSettings::isTextureCompressionEnabled() const
{
return supportsTextureCompression() && UserConfigParams::m_texture_compression;
}
// See http://visual-computing.intel-research.net/art/publications/sdsm/
bool CentralVideoSettings::isSDSMEnabled() const
{
return isShadowEnabled() && isARBShaderAtomicCountersUsable() && isARBShaderStorageBufferObjectUsable() && isARBComputeShaderUsable() && isARBImageLoadStoreUsable() && UserConfigParams::m_sdsm;
}
// Switch between Exponential Shadow Map (better but slower filtering) and Percentage Closer Filtering (faster but with some stability issue)
bool CentralVideoSettings::isESMEnabled() const
{
return UserConfigParams::m_esm;
}
bool CentralVideoSettings::isDefferedEnabled() const
{
return UserConfigParams::m_dynamic_lights && !GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_ADVANCED_PIPELINE);

View File

@@ -44,7 +44,6 @@ private:
bool hasTextureFilterAnisotropic;
bool hasTextureSwizzle;
bool hasPixelBufferObject;
bool hasSRGBFramebuffer;
bool hasSamplerObjects;
bool hasVertexType2101010Rev;
bool hasInstancedArrays;
@@ -54,9 +53,7 @@ private:
bool hasColorBufferFloat;
#endif
bool m_need_rh_workaround;
bool m_need_vertex_id_workaround;
bool m_GI_has_artifact;
public:
static bool m_supports_sp;
@@ -85,7 +82,6 @@ public:
bool isEXTTextureFilterAnisotropicUsable() const;
bool isARBTextureSwizzleUsable() const;
bool isARBPixelBufferObjectUsable() const;
bool isARBSRGBFramebufferUsable() const;
bool isARBSamplerObjectsUsable() const;
bool isARBVertexType2101010RevUsable() const;
bool useArrayTextures() const;
@@ -98,9 +94,7 @@ public:
bool isEXTColorBufferFloatUsable() const;
#endif
// Are all required extensions available for feature support
bool supportsGlobalIllumination() const;
bool supportsComputeShadersFiltering() const;
bool supportsHardwareSkinning() const;
bool supportsTextureCompression() const;
@@ -109,10 +103,7 @@ public:
// "Macro" around feature support and user config
bool isShadowEnabled() const;
bool isGlobalIlluminationEnabled() const;
bool isTextureCompressionEnabled() const;
bool isSDSMEnabled() const;
bool isESMEnabled() const;
bool isDefferedEnabled() const;
};

View File

@@ -159,92 +159,6 @@ public:
} // PointLightScatterShader
};
#if !defined(USE_GLES2)
// ============================================================================
class RadianceHintsConstructionShader
: public TextureShader<RadianceHintsConstructionShader, 3, core::matrix4,
core::matrix4, core::vector3df, video::SColorf>
{
public:
RadianceHintsConstructionShader()
{
if (CVS->supportsGLLayerInVertexShader())
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "slicedscreenquad.vert",
GL_FRAGMENT_SHADER, "rh.frag");
}
else
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "slicedscreenquad.vert",
GL_GEOMETRY_SHADER, "rhpassthrough.geom",
GL_FRAGMENT_SHADER, "rh.frag");
}
assignUniforms("RSMMatrix", "RHMatrix", "extents", "suncol");
assignSamplerNames(0, "ctex", ST_BILINEAR_FILTERED,
1, "ntex", ST_BILINEAR_FILTERED,
2, "dtex", ST_BILINEAR_FILTERED);
} // RadianceHintsConstructionShader
}; // RadianceHintsConstructionShader
// ============================================================================
// Workaround for a bug found in kepler nvidia linux and fermi nvidia windows
class NVWorkaroundRadianceHintsConstructionShader
: public TextureShader<NVWorkaroundRadianceHintsConstructionShader,
3, core::matrix4, core::matrix4, core::vector3df,
int, video::SColorf >
{
public:
NVWorkaroundRadianceHintsConstructionShader()
{
loadProgram(OBJECT,GL_VERTEX_SHADER,"slicedscreenquad_nvworkaround.vert",
GL_GEOMETRY_SHADER, "rhpassthrough.geom",
GL_FRAGMENT_SHADER, "rh.frag");
assignUniforms("RSMMatrix", "RHMatrix", "extents", "slice", "suncol");
assignSamplerNames(0, "ctex", ST_BILINEAR_FILTERED,
1, "ntex", ST_BILINEAR_FILTERED,
2, "dtex", ST_BILINEAR_FILTERED);
} // NVWorkaroundRadianceHintsConstructionShader
}; // NVWorkaroundRadianceHintsConstructionShader
#endif // !defined(USE_GLES2)
// ============================================================================
class GlobalIlluminationReconstructionShader
: public TextureShader<GlobalIlluminationReconstructionShader, 5,
core::matrix4, core::matrix4, core::vector3df >
{
public:
GlobalIlluminationReconstructionShader()
{
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
GL_FRAGMENT_SHADER, "gi.frag");
assignUniforms("rh_matrix", "inv_rh_matrix", "extents");
assignSamplerNames(0, "ntex", ST_NEAREST_FILTERED,
1, "dtex", ST_NEAREST_FILTERED,
2, "SHR", ST_VOLUME_LINEAR_FILTERED,
3, "SHG", ST_VOLUME_LINEAR_FILTERED,
4, "SHB", ST_VOLUME_LINEAR_FILTERED);
} // GlobalIlluminationReconstructionShader
// ------------------------------------------------------------------------
void render(const core::matrix4 &rh_matrix,
const core::vector3df &rh_extend, const FrameBuffer &fb,
GLuint normal_depth_texture,
GLuint depth_stencil_texture)
{
core::matrix4 inv_rh_matrix;
rh_matrix.getInverse(inv_rh_matrix);
glDisable(GL_DEPTH_TEST);
setTextureUnits(normal_depth_texture,
depth_stencil_texture,
fb.getRTT()[0], fb.getRTT()[1], fb.getRTT()[2]);
drawFullScreenEffect(rh_matrix, inv_rh_matrix, rh_extend);
} // render
}; // GlobalIlluminationReconstructionShader
// ============================================================================
class IBLShader : public TextureShader<IBLShader, 3>
{
@@ -534,64 +448,6 @@ void LightingPasses::updateLightsInfo(scene::ICameraSceneNode * const camnode,
m_point_light_count++;
} // updateLightsInfo
// ----------------------------------------------------------------------------
void LightingPasses::renderRadianceHints( const ShadowMatrices& shadow_matrices,
const FrameBuffer& radiance_hint_framebuffer,
const FrameBuffer& reflective_shadow_map_framebuffer)
{
#if !defined(USE_GLES2)
glDisable(GL_BLEND);
radiance_hint_framebuffer.bind();
glBindVertexArray(SharedGPUObjects::getFullScreenQuadVAO());
if (CVS->needRHWorkaround())
{
NVWorkaroundRadianceHintsConstructionShader::getInstance()->use();
NVWorkaroundRadianceHintsConstructionShader::getInstance()
->setTextureUnits(
reflective_shadow_map_framebuffer.getRTT()[0],
reflective_shadow_map_framebuffer.getRTT()[1],
reflective_shadow_map_framebuffer.getDepthTexture());
for (unsigned i = 0; i < 32; i++)
{
NVWorkaroundRadianceHintsConstructionShader::getInstance()
->setUniforms(shadow_matrices.getRSMMatrix(),
shadow_matrices.getRHMatrix(),
shadow_matrices.getRHExtend(), i,
irr_driver->getSunColor());
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
else
{
RadianceHintsConstructionShader::getInstance()->use();
RadianceHintsConstructionShader::getInstance()
->setTextureUnits(
reflective_shadow_map_framebuffer.getRTT()[0],
reflective_shadow_map_framebuffer.getRTT()[1],
reflective_shadow_map_framebuffer.getDepthTexture()
);
RadianceHintsConstructionShader::getInstance()
->setUniforms(shadow_matrices.getRSMMatrix(),
shadow_matrices.getRHMatrix(),
shadow_matrices.getRHExtend(),
irr_driver->getSunColor());
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, 32);
}
#endif //!defined(USE_GLES2)
} // renderRadianceHints
// ----------------------------------------------------------------------------
void LightingPasses::renderGlobalIllumination( const ShadowMatrices& shadow_matrices,
const FrameBuffer& radiance_hint_framebuffer,
GLuint normal_depth_texture,
GLuint depth_stencil_texture)
{
GlobalIlluminationReconstructionShader::getInstance()
->render(shadow_matrices.getRHMatrix(), shadow_matrices.getRHExtend(),
radiance_hint_framebuffer, normal_depth_texture,
depth_stencil_texture);
}
// ----------------------------------------------------------------------------
void LightingPasses::renderLights( bool has_shadow,
GLuint normal_depth_texture,
@@ -617,22 +473,11 @@ void LightingPasses::renderLights( bool has_shadow,
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_ONE, GL_ONE);
glBlendEquation(GL_FUNC_ADD);
if (CVS->isESMEnabled())
{
ShadowedSunLightShaderESM::getInstance()->render(normal_depth_texture,
depth_stencil_texture,
shadow_framebuffer);
}
else
{
ShadowedSunLightShaderPCF::getInstance()->render(normal_depth_texture,
depth_stencil_texture,
shadow_framebuffer,
irr_driver->getSunDirection(),
irr_driver->getSunColor());
}
ShadowedSunLightShaderPCF::getInstance()->render(normal_depth_texture,
depth_stencil_texture,
shadow_framebuffer,
irr_driver->getSunDirection(),
irr_driver->getSunColor());
}
else
renderSunlight(irr_driver->getSunDirection(),

View File

@@ -47,15 +47,6 @@ public:
void updateLightsInfo(irr::scene::ICameraSceneNode * const camnode,
float dt);
void renderRadianceHints( const ShadowMatrices& shadow_matrices,
const FrameBuffer& radiance_hint_framebuffer,
const FrameBuffer& reflective_shadow_map_framebuffer);
void renderGlobalIllumination( const ShadowMatrices& shadow_matrices,
const FrameBuffer& radiance_hint_framebuffer,
GLuint normal_depth_texture,
GLuint depth_stencil_texture);
void renderLights( bool has_shadow,
GLuint normal_depth_texture,
GLuint depth_stencil_texture,

View File

@@ -930,70 +930,6 @@ void PostProcessing::renderGaussian3Blur(const FrameBuffer &in_fbo,
}
} // renderGaussian3Blur
// ----------------------------------------------------------------------------
void PostProcessing::renderGaussian6BlurLayer(const FrameBuffer &in_fbo,
const FrameBuffer &scalar_fbo,
unsigned int layer, float sigma_h,
float sigma_v) const
{
/*
#if !defined(USE_GLES2)
GLuint layer_tex;
glGenTextures(1, &layer_tex);
glTextureView(layer_tex, GL_TEXTURE_2D, in_fbo.getRTT()[0],
GL_R32F, 0, 1, layer, 1);
if (!CVS->supportsComputeShadersFiltering())
{
// Used as temp
scalar_fbo.bind();
Gaussian6VBlurShader::getInstance()
->render(layer_tex, UserConfigParams::m_shadows_resolution,
UserConfigParams::m_shadows_resolution, sigma_v);
in_fbo.bindLayer(layer);
Gaussian6HBlurShader::getInstance()
->render(scalar_fbo,
UserConfigParams::m_shadows_resolution,
UserConfigParams::m_shadows_resolution, sigma_h);
}
else
{
const std::vector<float> &weightsV = getGaussianWeight(sigma_v, 7);
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT);
ComputeShadowBlurVShader::getInstance()->use();
ComputeShadowBlurVShader::getInstance()->setTextureUnits(layer_tex);
glBindSampler(ComputeShadowBlurVShader::getInstance()->m_dest_tu, 0);
glBindImageTexture(ComputeShadowBlurVShader::getInstance()->m_dest_tu,
scalar_fbo.getRTT()[0], 0,
false, 0, GL_WRITE_ONLY, GL_R32F);
ComputeShadowBlurVShader::getInstance()->setUniforms
(core::vector2df(1.f / UserConfigParams::m_shadows_resolution,
1.f / UserConfigParams::m_shadows_resolution),
weightsV);
glDispatchCompute((int)UserConfigParams::m_shadows_resolution / 8 + 1,
(int)UserConfigParams::m_shadows_resolution / 8 + 1, 1);
const std::vector<float> &weightsH = getGaussianWeight(sigma_h, 7);
glMemoryBarrier( GL_TEXTURE_FETCH_BARRIER_BIT
| GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
ComputeShadowBlurHShader::getInstance()->use();
ComputeShadowBlurHShader::getInstance()
->setTextureUnits(scalar_fbo.getRTT()[0]);
glBindSampler(ComputeShadowBlurHShader::getInstance()->m_dest_tu, 0);
glBindImageTexture(ComputeShadowBlurHShader::getInstance()->m_dest_tu,
layer_tex, 0, false, 0, GL_WRITE_ONLY, GL_R32F);
ComputeShadowBlurHShader::getInstance()->setUniforms
(core::vector2df(1.f / UserConfigParams::m_shadows_resolution,
1.f / UserConfigParams::m_shadows_resolution),
weightsH);
glDispatchCompute((int)UserConfigParams::m_shadows_resolution / 8 + 1,
(int)UserConfigParams::m_shadows_resolution / 8 + 1, 1);
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
}
glDeleteTextures(1, &layer_tex);
#endif*/
} // renderGaussian6BlurLayer
// ----------------------------------------------------------------------------
void PostProcessing::renderGaussian6Blur(const FrameBuffer &in_fbo,
const FrameBuffer &auxiliary, float sigma_v,
@@ -1491,10 +1427,6 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
PROFILER_POP_CPU_MARKER();
}
#if !defined(USE_GLES2)
if (CVS->isARBSRGBFramebufferUsable())
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
out_fbo = &rtts->getFBO(FBO_MLAA_COLORS);
out_fbo->bind();
renderPassThrough(in_fbo->getRTT()[0],
@@ -1510,10 +1442,6 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
*out_fbo);
PROFILER_POP_CPU_MARKER();
}
#if !defined(USE_GLES2)
if (CVS->isARBSRGBFramebufferUsable())
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
return out_fbo;
} // render

View File

@@ -80,8 +80,6 @@ public:
float sigmaV, float sigmaH) const;
void renderHorizontalBlur(const FrameBuffer &in_fbo, const FrameBuffer &auxiliary) const;
void renderGaussian6BlurLayer(const FrameBuffer &in_fbo, const FrameBuffer &scalar_fbo,
unsigned int layer, float sigmaH, float sigmaV) const;
void renderGaussian17TapBlur(const FrameBuffer &in_fbo,
const FrameBuffer &auxiliary,
const FrameBuffer &linear_depth) const;

View File

@@ -19,7 +19,6 @@
#include "graphics/render_target.hpp"
#include "graphics/2dutils.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/frame_buffer.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/rtts.hpp"
@@ -148,19 +147,10 @@ void GL3RenderTarget::draw2DImage(const irr::core::rect<s32>& dest_rect,
assert(m_frame_buffer != NULL);
irr::core::rect<s32> source_rect(0, 0, m_frame_buffer->getWidth(),
m_frame_buffer->getHeight());
#if !defined(USE_GLES2)
if (CVS->isARBSRGBFramebufferUsable())
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
draw2DImageFromRTT(m_frame_buffer->getRTT()[0],
m_frame_buffer->getWidth(), m_frame_buffer->getHeight(),
dest_rect, source_rect,
clip_rect, colors, use_alpha_channel_of_texture);
#if !defined(USE_GLES2)
if (CVS->isARBSRGBFramebufferUsable())
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
} // draw2DImage
#endif // !SERVER_ONLY

View File

@@ -58,12 +58,9 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale)
m_width = (unsigned int)(width * rtt_scale);
m_height = (unsigned int)(height * rtt_scale);
m_shadow_FBO = NULL;
m_RH_FBO = NULL;
m_RSM = NULL;
m_RH_FBO = NULL;
using namespace video;
using namespace core;
dimension2du res(m_width, m_height);
const dimension2du half = res/2;
@@ -91,7 +88,7 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale)
GLint rgb_format = GL_BGR;
GLint diffuse_specular_internal_format = GL_R11F_G11F_B10F;
GLint type = GL_FLOAT;
GLint srgb_internal_format = GL_SRGB8_ALPHA8;
GLint rgb_internal_format = GL_RGBA8;
#if defined(USE_GLES2)
if (!CVS->isEXTColorBufferFloatUsable())
@@ -107,9 +104,6 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale)
}
#endif
if (!CVS->isARBSRGBFramebufferUsable())
srgb_internal_format = GL_RGBA8;
RenderTargetTextures[RTT_TMP1] = generateRTT(res, rgba_internal_format, rgba_format, type);
RenderTargetTextures[RTT_TMP2] = generateRTT(res, rgba_internal_format, rgba_format, type);
RenderTargetTextures[RTT_TMP3] = generateRTT(res, rgba_internal_format, rgba_format, type);
@@ -117,9 +111,9 @@ RTT::RTT(unsigned int width, unsigned int height, float rtt_scale)
RenderTargetTextures[RTT_LINEAR_DEPTH] = generateRTT(res, red32_internal_format, red_format, type, linear_depth_mip_levels);
RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV);
RenderTargetTextures[RTT_COLOR] = generateRTT(res, rgba_internal_format, rgba_format, type);
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, srgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
RenderTargetTextures[RTT_MLAA_TMP] = generateRTT(res, srgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
RenderTargetTextures[RTT_MLAA_BLEND] = generateRTT(res, srgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
RenderTargetTextures[RTT_MLAA_TMP] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
RenderTargetTextures[RTT_MLAA_BLEND] = generateRTT(res, rgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
RenderTargetTextures[RTT_SSAO] = generateRTT(res, red_internal_format, red_format, type);
RenderTargetTextures[RTT_DISPLACE] = generateRTT(res, rgba_internal_format, rgba_format, type);
RenderTargetTextures[RTT_DIFFUSE] = generateRTT(res, diffuse_specular_internal_format, rgb_format, type);
@@ -294,18 +288,6 @@ RTT::~RTT()
delete m_shadow_FBO;
glDeleteTextures(1, &shadowDepthTex);
}
if (CVS->isGlobalIlluminationEnabled())
{
delete m_RH_FBO;
delete m_RSM;
glDeleteTextures(1, &RSM_Color);
glDeleteTextures(1, &RSM_Normal);
glDeleteTextures(1, &RSM_Depth);
glDeleteTextures(1, &RH_Red);
glDeleteTextures(1, &RH_Green);
glDeleteTextures(1, &RH_Blue);
}
}
#endif // !SERVER_ONLY

View File

@@ -150,27 +150,20 @@ public:
unsigned int getHeight() const { return m_height; }
FrameBufferLayer &getShadowFrameBuffer() { return *m_shadow_FBO; }
FrameBufferLayer &getRadianceHintFrameBuffer() { return *m_RH_FBO; }
FrameBufferLayer &getReflectiveShadowMapFrameBuffer() { return *m_RSM; }
unsigned getDepthStencilTexture() const { return DepthStencilTexture; }
unsigned getRenderTarget(enum TypeRTT target) const { return RenderTargetTextures[target]; }
FrameBuffer& getFBO(enum TypeFBO fbo) { return FrameBuffers[fbo]; }
const std::vector<uint64_t>& getPrefilledHandles() { return m_prefilled_handles; }
private:
unsigned RenderTargetTextures[RTT_COUNT];
PtrVector<FrameBuffer> FrameBuffers;
std::vector<uint64_t> m_prefilled_handles;
unsigned DepthStencilTexture;
unsigned int m_width;
unsigned int m_height;
unsigned shadowDepthTex;
unsigned RSM_Color, RSM_Normal, RSM_Depth;
unsigned RH_Red, RH_Green, RH_Blue;
FrameBufferLayer* m_shadow_FBO, *m_RSM, *m_RH_FBO;
FrameBufferLayer* m_shadow_FBO;
LEAK_CHECK();
};

View File

@@ -181,12 +181,9 @@ void ShaderBasedRenderer::renderShadows()
glDisable(GL_BLEND);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.5, 50.);
if (!CVS->isESMEnabled())
{
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.5, 50.);
}
if (CVS->supportsGLLayerInVertexShader())
{
m_rtts->getShadowFrameBuffer().bindDepthOnly();
@@ -416,10 +413,6 @@ void ShaderBasedRenderer::renderSceneDeferred(scene::ICameraSceneNode * const ca
if (!forceRTT)
{
#if !defined(USE_GLES2)
if (CVS->isARBSRGBFramebufferUsable())
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
return;
@@ -530,10 +523,6 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode,
if (!CVS->isDefferedEnabled() && !forceRTT)
{
#if !defined(USE_GLES2)
if (CVS->isARBSRGBFramebufferUsable())
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
return;
@@ -617,29 +606,15 @@ void ShaderBasedRenderer::renderPostProcessing(Camera * const camera)
camera->activate();
m_post_processing->renderPassThrough(m_rtts->getFBO(FBO_HALF1_R).getRTT()[0], viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
}
else if (irr_driver->getRSM())
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
camera->activate();
m_post_processing->renderPassThrough(m_rtts->getReflectiveShadowMapFrameBuffer().getRTT()[0], viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
}
else if (irr_driver->getShadowViz())
{
m_shadow_matrices.renderShadowsDebug(m_rtts->getShadowFrameBuffer(), m_post_processing);
}
else
{
#if !defined(USE_GLES2)
if (CVS->isARBSRGBFramebufferUsable())
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
glBindFramebuffer(GL_FRAMEBUFFER, 0);
camera->activate();
m_post_processing->renderPassThrough(fbo->getRTT()[0], viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
#if !defined(USE_GLES2)
if (CVS->isARBSRGBFramebufferUsable())
glDisable(GL_FRAMEBUFFER_SRGB);
#endif
}
} //renderPostProcessing
@@ -809,11 +784,6 @@ void ShaderBasedRenderer::render(float dt)
rg->preRenderCallback(camera); // adjusts start referee
irr_driver->getSceneManager()->setActiveCamera(camnode);
#if !defined(USE_GLES2)
if (!CVS->isDefferedEnabled() && CVS->isARBSRGBFramebufferUsable())
glEnable(GL_FRAMEBUFFER_SRGB);
#endif
computeMatrixesAndCameras(camnode, m_rtts->getWidth(), m_rtts->getHeight());
if (CVS->isDefferedEnabled())
{

View File

@@ -179,8 +179,6 @@ GLuint ShaderFilesManager::loadShader(const std::string &file, unsigned type)
code << "#define Needs_Vertex_Id_Workaround\n";
if (CVS->isDefferedEnabled())
code << "#define Advanced_Lighting_Enabled\n";
if (CVS->isARBSRGBFramebufferUsable())
code << "#define sRGB_Framebuffer_Usable\n";
#if !defined(USE_GLES2)
// shader compilation fails with some drivers if there is no precision

View File

@@ -41,50 +41,6 @@
float ShadowMatrices:: m_shadow_split[5] = { 1., 5., 20., 50., 150 };
// ============================================================================
class LightspaceBoundingBoxShader
: public TextureShader<LightspaceBoundingBoxShader, 1,
core::matrix4, float, float, float, float>
{
public:
LightspaceBoundingBoxShader()
{
#if !defined(USE_GLES2)
loadProgram(OBJECT, GL_COMPUTE_SHADER, "Lightspaceboundingbox.comp");
assignSamplerNames(0, "depth", ST_NEAREST_FILTERED);
assignUniforms("SunCamMatrix", "split0", "split1", "split2", "splitmax");
GLuint block_idx =
glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK,
"BoundingBoxes");
glShaderStorageBlockBinding(m_program, block_idx, 2);
#endif
} // LightspaceBoundingBoxShader
}; // LightspaceBoundingBoxShader
// ============================================================================
class ShadowMatricesGenerationShader
: public Shader <ShadowMatricesGenerationShader, core::matrix4>
{
public:
ShadowMatricesGenerationShader()
{
#if !defined(USE_GLES2)
loadProgram(OBJECT, GL_COMPUTE_SHADER, "shadowmatrixgeneration.comp");
assignUniforms("SunCamMatrix");
GLuint block_idx =
glGetProgramResourceIndex(m_program,
GL_SHADER_STORAGE_BLOCK, "BoundingBoxes");
glShaderStorageBlockBinding(m_program, block_idx, 2);
block_idx =
glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK,
"NewMatrixData");
glShaderStorageBlockBinding(m_program, block_idx, 1);
#endif
}
}; // ShadowMatricesGenerationShader
// ============================================================================
class ViewFrustrumShader : public Shader<ViewFrustrumShader, video::SColor, int>
{
@@ -229,88 +185,6 @@ core::matrix4 ShadowMatrices::getTighestFitOrthoProj(const core::matrix4 &transf
return tmp_matrix;
} // getTighestFitOrthoProj
// ----------------------------------------------------------------------------
/** Update shadowSplit values and make Cascade Bounding Box pointer valid.
* The function aunches two compute kernel that generates an histogram of the
* depth buffer value (between 0 and 250 with increment of 0.25) and get an
* axis aligned bounding box (from SunCamMatrix view) containing all depth
* buffer value. It also retrieves the result from the previous computations
* (in a Round Robin fashion) and update CBB pointer.
* \param width of the depth buffer
* \param height of the depth buffer
* TODO : The depth histogram part is commented out, needs to tweak it when
* I have some motivation
*/
void ShadowMatrices::updateSplitAndLightcoordRangeFromComputeShaders(unsigned int width,
unsigned int height,
GLuint depth_stencil_texture)
{
#if !defined(USE_GLES2)
struct CascadeBoundingBox
{
int xmin;
int xmax;
int ymin;
int ymax;
int zmin;
int zmax;
}; // struct CascadeBoundingBox
// Value that should be kept between multiple calls
static bool ssboInit = false;
static GLuint CBBssbo, tempShadowMatssbo;
CascadeBoundingBox InitialCBB[4];
for (unsigned i = 0; i < 4; i++)
{
InitialCBB[i].xmin = InitialCBB[i].ymin = InitialCBB[i].zmin = 1000;
InitialCBB[i].xmax = InitialCBB[i].ymax = InitialCBB[i].zmax = -1000;
}
if (!ssboInit)
{
glGenBuffers(1, &CBBssbo);
glGenBuffers(1, &tempShadowMatssbo);
ssboInit = true;
}
glBindBuffer(GL_SHADER_STORAGE_BUFFER, CBBssbo);
glBufferData(GL_SHADER_STORAGE_BUFFER, 4 * sizeof(CascadeBoundingBox),
InitialCBB, GL_STATIC_DRAW);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, CBBssbo);
LightspaceBoundingBoxShader::getInstance()->use();
LightspaceBoundingBoxShader::getInstance()
->setTextureUnits(depth_stencil_texture);
LightspaceBoundingBoxShader::getInstance()
->setUniforms(m_sun_cam->getViewMatrix(),
ShadowMatrices::m_shadow_split[1],
ShadowMatrices::m_shadow_split[2],
ShadowMatrices::m_shadow_split[3],
ShadowMatrices::m_shadow_split[4]);
glDispatchCompute((int)width / 64, (int)height / 64, 1);
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, tempShadowMatssbo);
glBufferData(GL_SHADER_STORAGE_BUFFER, 4 * 16 * sizeof(float), 0,
GL_STATIC_COPY);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, tempShadowMatssbo);
ShadowMatricesGenerationShader::getInstance()->use();
ShadowMatricesGenerationShader::getInstance()
->setUniforms(m_sun_cam->getViewMatrix());
glDispatchCompute(4, 1, 1);
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
glBindBuffer(GL_COPY_READ_BUFFER, tempShadowMatssbo);
glBindBuffer(GL_COPY_WRITE_BUFFER,
SharedGPUObjects::getViewProjectionMatricesUBO());
glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0,
80 * sizeof(float), 4 * 16 * sizeof(float));
#endif
} // updateSplitAndLightcoordRangeFromComputeShaders
// ----------------------------------------------------------------------------
/** Generate View, Projection, Inverse View, Inverse Projection, ViewProjection
* and InverseProjection matrixes and matrixes and cameras for the four shadow
@@ -323,8 +197,6 @@ void ShadowMatrices::computeMatrixesAndCameras(scene::ICameraSceneNode *const ca
unsigned int width, unsigned int height,
GLuint depth_stencil_texture)
{
if (CVS->isSDSMEnabled())
updateSplitAndLightcoordRangeFromComputeShaders(width, height, depth_stencil_texture);
camnode->render();
irr_driver->setProjMatrix(irr_driver->getVideoDriver()
->getTransform(video::ETS_PROJECTION));

View File

@@ -54,9 +54,6 @@ private:
core::matrix4 m_rh_matrix;
float m_mat_ubo[16 * 9 + 2];
void updateSplitAndLightcoordRangeFromComputeShaders(unsigned int width,
unsigned int height,
GLuint depth_stencil_texture);
core::matrix4 getTighestFitOrthoProj(const core::matrix4 &transform,
const std::vector<core::vector3df> &pointsInside,
std::pair<float, float> &size);

View File

@@ -179,8 +179,7 @@ void Skybox::generateCubeMapFromTextures()
glBindTexture(GL_TEXTURE_CUBE_MAP, m_cube_map);
bool needs_srgb_format = CVS->isARBSRGBFramebufferUsable() ||
CVS->isDefferedEnabled();
bool needs_srgb_format = CVS->isDefferedEnabled();
GLint format = GL_RGBA;
GLint internal_format = needs_srgb_format ? GL_SRGB8_ALPHA8 : GL_RGBA8;

View File

@@ -38,9 +38,8 @@ STKTexture::STKTexture(const std::string& path, TexConfig* tc, bool no_upload)
#ifndef SERVER_ONLY
if (m_tex_config)
{
if (ProfileWorld::isNoGraphics() || (!CVS->isARBSRGBFramebufferUsable()
&& !CVS->isDefferedEnabled()) ||
!CVS->isGLSL())
if (ProfileWorld::isNoGraphics() ||
(!CVS->isDefferedEnabled()) || !CVS->isGLSL())
{
m_tex_config->m_srgb = false;
}
@@ -214,8 +213,7 @@ void STKTexture::formatConversion(uint8_t* data, unsigned int* format,
{
alpha /= 255.0f;
if (CVS->isARBSRGBFramebufferUsable() ||
CVS->isDefferedEnabled())
if (CVS->isDefferedEnabled())
{
alpha = pow(alpha, 1.0f / 2.2f);
}

View File

@@ -632,7 +632,7 @@ void STKHost::handleDirectSocketRequest()
{
// In case of a LAN connection, we only allow connections from
// a LAN address (192.168*, ..., and 127.*).
if (NetworkConfig::get()->isLAN() && !sender.isLAN() && false)
if (NetworkConfig::get()->isLAN() && !sender.isLAN())
{
Log::error("STKHost", "Client trying to connect from '%s'",
sender.toString().c_str());