Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented static nodes. #524

Merged
merged 6 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions data/vcpkg/ports/rendergraph/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH
REPO DragonJoker/RenderGraph
REF 82551835318c18724d9e5b2be48693d4e8ec5289
REF e884ce660c3f22b3c6f1ef4d1a5a5db5354038ec
HEAD_REF master
SHA512 18e9fc24c386fd0c0f03abb2f865fa99b7ed9e836cfc41d87a1d31e1f266410426344fd17932ad45576f4c70a74cf15007cb5c50023e6e4171d1ca9cde02e68a
SHA512 d617c83f1b8f3d3b5a0b75d310e8109e58e3fb3074c86eb0ef49816031d1b5f3bd6a1a2265d99e2eb2e97c888e121d9a42549a8271d8ff3862285222660ffcd7
)

vcpkg_from_github(OUT_SOURCE_PATH CMAKE_SOURCE_PATH
Expand Down
6 changes: 3 additions & 3 deletions include/Core/Castor3D/Limits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,23 @@ namespace castor3d
* Directional Light Shadows.
*/
//@{
static uint32_t constexpr ShadowMapDirectionalTextureSize = 2'048u;
static uint32_t constexpr ShadowMapDirectionalTextureSize = 1024u;
static uint32_t constexpr DirectionalMaxCascadesCount = 4u;
//@}
/**
*\name
* Point Light Shadows.
*/
//@{
static uint32_t constexpr ShadowMapPointTextureSize = 512u;
static uint32_t constexpr ShadowMapPointTextureSize = 256u;
static uint32_t constexpr PointShadowMapCount = 6u;
//@}
/**
*\name
* Spot Light Shadows.
*/
//@{
static uint32_t constexpr ShadowMapSpotTextureSize = 512u;
static uint32_t constexpr ShadowMapSpotTextureSize = 256u;
static uint32_t constexpr SpotShadowMapCount = 10u;
//@}
/**
Expand Down
5 changes: 5 additions & 0 deletions include/Core/Castor3D/Render/GBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ namespace castor3d
{
return m_result.end();
}

TextureArray::size_type size()
{
return m_result.size();
}
/**@}*/

protected:
Expand Down
17 changes: 11 additions & 6 deletions include/Core/Castor3D/Render/PipelineFlags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ namespace castor3d
, ProgramFlags programFlags = ProgramFlag::eNone
, TextureCombine ptextures = TextureCombine{}
, ShaderFlags shaderFlags = ShaderFlag::eNone
, VkCompareOp alphaFunc = VkCompareOp::VK_COMPARE_OP_ALWAYS
, uint32_t passLayerIndex = 0u )
, VkCompareOp palphaFunc = VkCompareOp::VK_COMPARE_OP_ALWAYS
, uint32_t ppassLayerIndex = 0u
, bool pisStatic = false )
: components{ std::move( pcomponents ) }
, textures{ std::move( ptextures ) }
, lightingModelId{ plightingModelId }
, alphaFunc{ alphaFunc }
, passLayerIndex{ passLayerIndex }
, alphaFunc{ palphaFunc }
, passLayerIndex{ ppassLayerIndex }
, isStatic{ pisStatic }
, m_submeshFlags{ submeshFlags }
, m_programFlags{ programFlags }
, m_shaderFlags{ shaderFlags }
Expand All @@ -56,6 +58,7 @@ namespace castor3d
LightingModelID lightingModelId;
VkCompareOp alphaFunc;
uint32_t passLayerIndex;
bool isStatic;
//uint32_t maxTexcoordSet;
SubmeshFlags m_submeshFlags;
ProgramFlags m_programFlags;
Expand Down Expand Up @@ -125,15 +128,17 @@ namespace castor3d
, VkCompareOp palphaFunc = VK_COMPARE_OP_ALWAYS
, TextureCombine textures = {}
, uint32_t ppassLayerIndex = {}
, VkDeviceSize pmorphTargetsOffset = {} )
, VkDeviceSize pmorphTargetsOffset = {}
, bool pisStatic = false )
: PipelineFlags{ PipelineHiHashDetails{ std::move( pcomponents )
, plightingModelId
, psubmeshFlags
, pprogramFlags
, std::move( textures )
, pshaderFlags
, palphaFunc
, ppassLayerIndex }
, ppassLayerIndex
, pisStatic }
, PipelineLoHashDetails{ pbackgroundModelId, pmorphTargetsOffset }
, psceneFlags
, pcolourBlendMode
Expand Down
29 changes: 29 additions & 0 deletions include/Core/Castor3D/Render/RenderNodesPass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ namespace castor3d
m_ruConfig.maxPassCount = value;
return *this;
}
/**
*\~english
*\param[in] value \p true if the pass is for static nodes.
*\~french
*\param[in] value \p true si la passe est pour les noeuds statiques.
*/
RenderNodesPassDesc & isStatic( bool value )
{
m_handleStatic = value ? 2u : 1u;
return *this;
}
/**
*\~english
*\param[in] value The frame pass resettable status.
Expand Down Expand Up @@ -227,6 +238,7 @@ namespace castor3d
bool m_meshShading{};
SceneNode const * m_ignored{};
uint32_t m_index{ 0u };
uint32_t m_handleStatic{ 0u };
crg::ru::Config m_ruConfig{ 1u, true };
};

Expand Down Expand Up @@ -560,6 +572,7 @@ namespace castor3d
C3D_API virtual bool areValidPassFlags( PassComponentCombine const & passFlags )const;
C3D_API bool isValidPass( Pass const & pass )const;
C3D_API bool isValidRenderable( RenderedObject const & object )const;
C3D_API bool isValidNode( SceneNode const & node )const;
C3D_API bool isPassEnabled()const;
C3D_API Scene & getScene()const;
C3D_API SceneNode const * getIgnoredNode()const;
Expand Down Expand Up @@ -624,6 +637,21 @@ namespace castor3d
{
return m_typeID;
}

bool filtersStatic()const
{
return m_handleStatic == 1;
}

bool filtersNonStatic()const
{
return m_handleStatic == 2;
}

bool handleStatic()const
{
return m_handleStatic != 0;
}
/**@}*/

mutable PassSortNodesSignal onSortNodes;
Expand Down Expand Up @@ -806,6 +834,7 @@ namespace castor3d
bool m_meshShading{};
SceneUbo const * m_sceneUbo{};
uint32_t m_index{ 0u };
uint32_t m_handleStatic{};

private:
struct PassDescriptors
Expand Down
6 changes: 3 additions & 3 deletions include/Core/Castor3D/Render/RenderTechnique.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,17 @@ namespace castor3d

ShadowMapResult const & getDirectionalShadowPassResult()const
{
return m_directionalShadowMap->getShadowPassResult();
return m_directionalShadowMap->getShadowPassResult( false );
}

ShadowMapResult const & getPointShadowPassResult()const
{
return m_pointShadowMap->getShadowPassResult();
return m_pointShadowMap->getShadowPassResult( false );
}

ShadowMapResult const & getSpotShadowPassResult()const
{
return m_spotShadowMap->getShadowPassResult();
return m_spotShadowMap->getShadowPassResult( false );
}

LightVolumePassResult const & getLpvResult()const
Expand Down
68 changes: 50 additions & 18 deletions include/Core/Castor3D/Render/ShadowMap/ShadowMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace castor3d
*\brief Met à jour la passe de rendu, au niveau GPU.
*\param[in, out] updater Les données d'update.
*/
C3D_API virtual void update( GpuUpdater & updater ) = 0;
C3D_API void update( GpuUpdater & updater );
/**
*\~english
*\brief Renders the shadow map.
Expand Down Expand Up @@ -181,14 +181,14 @@ namespace castor3d
C3D_API virtual crg::ImageViewIdArray getViews( SmTexture texture
, uint32_t index = 0u )const;

ShadowMapResult const & getShadowPassResult()const
ShadowMapResult const & getShadowPassResult( bool isStatic )const
{
return m_result;
return isStatic ? m_staticsResult : m_result;
}

ShadowMapResult & getShadowPassResult()
ShadowMapResult & getShadowPassResult( bool isStatic )
{
return m_result;
return isStatic ? m_staticsResult : m_result;
}

Scene & getScene()const
Expand All @@ -202,13 +202,51 @@ namespace castor3d
}
/**@}*/

protected:
struct Passes
{
std::vector< PassDataPtr > passes;
std::vector< std::unique_ptr< crg::FrameGraph > > graphs;
std::vector< crg::RunnableGraphPtr > runnables;
std::vector< GaussianBlurUPtr > blurs;
};

struct AllPasses
{
Passes staticNodes;
Passes otherNodes;
};

protected:
C3D_API void doRegisterGraphIO( crg::FrameGraph & graph
, bool vsm
, bool rsm
, bool isStatic )const;

private:
C3D_API virtual std::vector< ShadowMap::PassDataPtr > doCreatePass( uint32_t index
crg::FramePassArray doCreatePasses( crg::FrameGraph & graph
, crg::FramePassArray const & previousPasses
, uint32_t index
, bool vsm
, bool rsm ) = 0;
C3D_API virtual bool doIsUpToDate( uint32_t index )const = 0;
C3D_API virtual void doSetUpToDate( uint32_t index ) = 0;
C3D_API virtual void doUpdate( CpuUpdater & updater ) = 0;
, bool rsm
, bool isStatic
, Passes & passes );

C3D_API virtual crg::FramePassArray doCreatePass( crg::FrameGraph & graph
, crg::FramePassArray const & previousPasses
, uint32_t index
, bool vsm
, bool rsm
, bool isStatic
, Passes & passes ) = 0;
C3D_API virtual bool doIsUpToDate( uint32_t index
, Passes const & passes )const = 0;
C3D_API virtual void doSetUpToDate( uint32_t index
, Passes & passes ) = 0;
C3D_API virtual void doUpdate( CpuUpdater & updater
, Passes & passes ) = 0;
C3D_API virtual void doUpdate( GpuUpdater & updater
, Passes & passes ) = 0;
C3D_API virtual uint32_t doGetMaxCount()const = 0;

protected:
Expand All @@ -217,17 +255,11 @@ namespace castor3d
Scene & m_scene;
castor::String m_name;
LightType m_lightType;
ShadowMapResult m_staticsResult;
ShadowMapResult m_result;
uint32_t m_count;
std::set< std::reference_wrapper< GeometryBuffers > > m_geometryBuffers;
struct Passes
{
std::vector< PassDataPtr > passes;
std::vector< std::unique_ptr< crg::FrameGraph > > graphs;
std::vector< crg::RunnableGraphPtr > runnables;
std::vector< GaussianBlurUPtr > blurs;
};
std::array< Passes, 4u > m_passes;
std::array< AllPasses, 4u > m_passes;
uint32_t m_passesIndex{};
};
}
Expand Down
24 changes: 15 additions & 9 deletions include/Core/Castor3D/Render/ShadowMap/ShadowMapDirectional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,24 @@ namespace castor3d
, RenderDevice const & device
, Scene & scene
, ProgressBar * progress );
/**
*\copydoc castor3d::ShadowMap::update
*/
C3D_API void update( GpuUpdater & updater )override;

private:
std::vector< ShadowMap::PassDataPtr > doCreatePass( uint32_t index
crg::FramePassArray doCreatePass( crg::FrameGraph & graph
, crg::FramePassArray const & previousPasses
, uint32_t index
, bool vsm
, bool rsm )override;
void doUpdate( CpuUpdater & updater )override;
bool doIsUpToDate( uint32_t index )const override;
void doSetUpToDate( uint32_t index )override;
, bool rsm
, bool isStatic
, Passes & passes )override;
bool doIsUpToDate( uint32_t index
, Passes const & passes )const override;
void doSetUpToDate( uint32_t index
, Passes & passes )override;
void doUpdate( CpuUpdater & updater
, Passes & passes )override;
void doUpdate( GpuUpdater & updater
, Passes & passes )override;

uint32_t doGetMaxCount()const override
{
return 1u;
Expand Down
3 changes: 2 additions & 1 deletion include/Core/Castor3D/Render/ShadowMap/ShadowMapPass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ namespace castor3d
, SceneCuller & culler
, ShadowMap const & shadowMap
, bool needsVsm
, bool needsRsm );
, bool needsRsm
, bool isStatic );
/**
*\~english
*name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace castor3d
, ShadowMap const & shadowMap
, bool needsVsm
, bool needsRsm
, bool isStatic
, uint32_t cascadeIndex );
/**
*\~english
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ namespace castor3d
, SceneCuller & culler
, ShadowMap const & shadowMap
, bool needsVsm
, bool needsRsm );
, bool needsRsm
, bool isStatic );
/**
*\~english
*\brief Destructor.
Expand Down
3 changes: 2 additions & 1 deletion include/Core/Castor3D/Render/ShadowMap/ShadowMapPassSpot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ namespace castor3d
, SceneCuller & culler
, ShadowMap const & shadowMap
, bool needsVsm
, bool needsRsm );
, bool needsRsm
, bool isStatic );
/**
*\~english
*\brief Destructor.
Expand Down
Loading