From 553a0a8b58346cc19066ff8e2e9703df5b65cf35 Mon Sep 17 00:00:00 2001 From: hiker Date: Tue, 19 May 2015 16:40:47 +1000 Subject: [PATCH] Moved more shaders. --- src/graphics/shaders.cpp | 13 ------------- src/graphics/shaders.hpp | 7 ------- src/graphics/shadow_matrixes.cpp | 26 ++++++++++++++++++++++++-- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 0c869507d..e88d7a0f4 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -457,19 +457,6 @@ namespace FullScreenShader assignUniforms("direction", "col"); } - - - ShadowMatrixesGenerationShader::ShadowMatrixesGenerationShader() - { - 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); - } - GlowShader::GlowShader() { loadProgram(OBJECT, diff --git a/src/graphics/shaders.hpp b/src/graphics/shaders.hpp index dfd277eeb..2fed461c8 100644 --- a/src/graphics/shaders.hpp +++ b/src/graphics/shaders.hpp @@ -88,13 +88,6 @@ public: SunLightShader(); }; - -class ShadowMatrixesGenerationShader : public Shader -{ -public: - ShadowMatrixesGenerationShader(); -}; - class GlowShader : public TextureShader { public: diff --git a/src/graphics/shadow_matrixes.cpp b/src/graphics/shadow_matrixes.cpp index 054787ae2..7e94b9729 100644 --- a/src/graphics/shadow_matrixes.cpp +++ b/src/graphics/shadow_matrixes.cpp @@ -53,6 +53,28 @@ public: } // LightspaceBoundingBoxShader }; // LightspaceBoundingBoxShader +// ============================================================================ +class ShadowMatricesGenerationShader + : public Shader +{ +public: + ShadowMatricesGenerationShader() + { + 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); + } + + +}; // ShadowMatricesGenerationShader + // ============================================================================ static std::vector getFrustrumVertex(const scene::SViewFrustum &frustrum) { @@ -194,8 +216,8 @@ void IrrDriver::updateSplitAndLightcoordRangeFromComputeShaders(size_t width, GL_STATIC_COPY); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, tempShadowMatssbo); - FullScreenShader::ShadowMatrixesGenerationShader::getInstance()->use(); - FullScreenShader::ShadowMatrixesGenerationShader::getInstance() + ShadowMatricesGenerationShader::getInstance()->use(); + ShadowMatricesGenerationShader::getInstance() ->setUniforms(m_suncam->getViewMatrix()); glDispatchCompute(4, 1, 1);