diff --git a/include/Nazara/Graphics/ElementRenderer.hpp b/include/Nazara/Graphics/ElementRenderer.hpp index 6d76a83d7..d9e974f2d 100644 --- a/include/Nazara/Graphics/ElementRenderer.hpp +++ b/include/Nazara/Graphics/ElementRenderer.hpp @@ -12,12 +12,13 @@ #include #include #include +#include #include namespace Nz { - class AbstractBuffer; class CommandBufferBuilder; + class RenderBuffer; class RenderElement; class RenderFrame; class ViewerInstance; @@ -38,7 +39,7 @@ namespace Nz struct RenderStates { - std::shared_ptr lightData; + std::optional lightData; }; }; diff --git a/include/Nazara/Graphics/ForwardFramePipeline.hpp b/include/Nazara/Graphics/ForwardFramePipeline.hpp index 3c3ad6dfc..43399deda 100644 --- a/include/Nazara/Graphics/ForwardFramePipeline.hpp +++ b/include/Nazara/Graphics/ForwardFramePipeline.hpp @@ -108,7 +108,7 @@ namespace Nz std::size_t m_depthPassIndex; std::size_t m_forwardPassIndex; - std::shared_ptr m_lightDataBuffer; + std::shared_ptr m_lightDataBuffer; std::unordered_map m_viewers; std::unordered_map m_materials; std::unordered_map> m_renderables; diff --git a/include/Nazara/Graphics/Graphics.hpp b/include/Nazara/Graphics/Graphics.hpp index e91ca11e3..c021fd109 100644 --- a/include/Nazara/Graphics/Graphics.hpp +++ b/include/Nazara/Graphics/Graphics.hpp @@ -19,7 +19,7 @@ namespace Nz { - class AbstractBuffer; + class RenderBuffer; class NAZARA_GRAPHICS_API Graphics : public ModuleBase { diff --git a/include/Nazara/Graphics/RenderQueueRegistry.hpp b/include/Nazara/Graphics/RenderQueueRegistry.hpp index fe5a75c69..2e97f97c1 100644 --- a/include/Nazara/Graphics/RenderQueueRegistry.hpp +++ b/include/Nazara/Graphics/RenderQueueRegistry.hpp @@ -13,7 +13,6 @@ namespace Nz { - class AbstractBuffer; class MaterialPass; class RenderPipeline; class VertexDeclaration; diff --git a/include/Nazara/Graphics/RenderSpriteChain.hpp b/include/Nazara/Graphics/RenderSpriteChain.hpp index 4604456c1..ff61e01a1 100644 --- a/include/Nazara/Graphics/RenderSpriteChain.hpp +++ b/include/Nazara/Graphics/RenderSpriteChain.hpp @@ -16,7 +16,6 @@ namespace Nz { - class AbstractBuffer; class MaterialPass; class VertexDeclaration; class ViewerInstance; diff --git a/include/Nazara/Graphics/RenderSubmesh.hpp b/include/Nazara/Graphics/RenderSubmesh.hpp index 692e33917..00d80f1bc 100644 --- a/include/Nazara/Graphics/RenderSubmesh.hpp +++ b/include/Nazara/Graphics/RenderSubmesh.hpp @@ -16,7 +16,6 @@ namespace Nz { - class AbstractBuffer; class MaterialPass; class RenderPipeline; class ShaderBinding; diff --git a/include/Nazara/Graphics/SpriteChainRenderer.hpp b/include/Nazara/Graphics/SpriteChainRenderer.hpp index b88059a95..0c1f20b04 100644 --- a/include/Nazara/Graphics/SpriteChainRenderer.hpp +++ b/include/Nazara/Graphics/SpriteChainRenderer.hpp @@ -18,7 +18,6 @@ namespace Nz { - class AbstractBuffer; class RenderDevice; class RenderPipeline; class RenderSpriteChain; diff --git a/include/Nazara/Graphics/SubmeshRenderer.hpp b/include/Nazara/Graphics/SubmeshRenderer.hpp index 407c96004..fd124bc9c 100644 --- a/include/Nazara/Graphics/SubmeshRenderer.hpp +++ b/include/Nazara/Graphics/SubmeshRenderer.hpp @@ -14,7 +14,6 @@ namespace Nz { - class AbstractBuffer; class RenderPipeline; class ShaderBinding; diff --git a/include/Nazara/Graphics/ViewerInstance.hpp b/include/Nazara/Graphics/ViewerInstance.hpp index 8a18a17ae..0a82b709b 100644 --- a/include/Nazara/Graphics/ViewerInstance.hpp +++ b/include/Nazara/Graphics/ViewerInstance.hpp @@ -15,9 +15,9 @@ namespace Nz { - class AbstractBuffer; class CommandBufferBuilder; class MaterialSettings; + class RenderBuffer; class UploadPool; class NAZARA_GRAPHICS_API ViewerInstance diff --git a/include/Nazara/Graphics/WorldInstance.hpp b/include/Nazara/Graphics/WorldInstance.hpp index e43aa3f2b..d3356985e 100644 --- a/include/Nazara/Graphics/WorldInstance.hpp +++ b/include/Nazara/Graphics/WorldInstance.hpp @@ -15,9 +15,9 @@ namespace Nz { - class AbstractBuffer; class CommandBufferBuilder; class MaterialSettings; + class RenderBuffer; class UploadPool; class WorldInstance; diff --git a/include/Nazara/Renderer/Renderer.hpp b/include/Nazara/Renderer/Renderer.hpp index 588963e2c..d5c2628bd 100644 --- a/include/Nazara/Renderer/Renderer.hpp +++ b/include/Nazara/Renderer/Renderer.hpp @@ -17,7 +17,6 @@ namespace Nz { - class AbstractBuffer; class Buffer; class NAZARA_RENDERER_API Renderer : public ModuleBase diff --git a/src/Nazara/Graphics/ForwardFramePipeline.cpp b/src/Nazara/Graphics/ForwardFramePipeline.cpp index 9bac97537..bc187cdc8 100644 --- a/src/Nazara/Graphics/ForwardFramePipeline.cpp +++ b/src/Nazara/Graphics/ForwardFramePipeline.cpp @@ -40,9 +40,7 @@ namespace Nz auto lightOffset = PredefinedLightData::GetOffsets(); - m_lightDataBuffer = Graphics::Instance()->GetRenderDevice()->InstantiateBuffer(BufferType::Uniform); - if (!m_lightDataBuffer->Initialize(lightOffset.totalSize, BufferUsage::DeviceLocal)) - throw std::runtime_error("failed to create light data buffer"); + m_lightDataBuffer = Graphics::Instance()->GetRenderDevice()->InstantiateBuffer(BufferType::Uniform, lightOffset.totalSize, BufferUsage::DeviceLocal | BufferUsage::Write); std::vector staticLightData(lightOffset.totalSize); /*AccessByOffset(staticLightData.data(), lightOffset.lightCountOffset) = 1;