11#include "misc/Error.h"
12#include "render/general/resource/frame/FrameResourceManager.h"
13#include "render/RenderSettings.h"
14#include "game/camera/CameraProperties.h"
15#include "render/RenderStatistics.h"
16#include "render/general/resource/MeshData.h"
17#include "shader/ComputeShaderInterface.h"
22 class PipelineManager;
24 class EnvironmentNode;
28 class ShadowMapHandle;
29 class DirectionalLightNode;
32 class GpuResourceManager;
33 class LightingShaderResourceManager;
34 class ShaderCpuWriteResourceBindingManager;
35 class ShaderTextureResourceBindingManager;
36 class ShaderLightArray;
38 class GlobalShaderResourceBindingManager;
39 struct ShaderLightsInFrustumSingleType;
40 struct GraphicsPipelineRegistry;
86 static std::variant<std::unique_ptr<Renderer>,
Error>
104 virtual std::variant<std::set<std::pair<unsigned int, unsigned int>>,
Error>
115 virtual std::variant<std::set<std::pair<unsigned int, unsigned int>>,
Error>
396 unsigned int& iShadowPassLightInfoArrayIndex);
408 unsigned int& iShadowPassLightInfoArrayIndex);
500 virtual std::variant<std::optional<AntialiasingQuality>,
Error>
557 size_t iCurrentFrameResourceIndex,
569 size_t iCurrentFrameResourceIndex,
570 const std::vector<Renderer::MeshesInFrustum::PipelineInFrustumInfo>& vOpaquePipelines) = 0;
583 size_t iCurrentFrameResourceIndex,
584 ComputeExecutionStage stage) = 0;
596 size_t iCurrentFrameResourceIndex,
597 const std::vector<Renderer::MeshesInFrustum::PipelineInFrustumInfo>& vOpaquePipelines,
598 const std::vector<Renderer::MeshesInFrustum::PipelineInFrustumInfo>& vTransparentPipelines) = 0;
711 CameraProperties* pActiveCameraProperties,
size_t iCurrentFrameResourceIndex);
745 static std::unique_ptr<Renderer>
763 static std::variant<std::unique_ptr<Renderer>, std::pair<Error, std::string>>
createRenderer(
766 const std::vector<std::string>& vBlacklistedGpuNames);
774 static void nanosleep(
long long iNanoseconds);
795 unsigned int iRenderTargetWidth,
796 unsigned int iRenderTargetHeight,
Definition: CameraManager.h:16
Definition: CameraProperties.h:22
Definition: DirectionalLightNode.h:14
Definition: EnvironmentNode.h:11
Definition: FrameResourceManager.h:46
Definition: GameManager.h:34
Definition: GlobalShaderResourceBindingManager.h:21
Definition: GpuResourceManager.h:43
Definition: GpuResource.h:16
Definition: LightingShaderResourceManager.h:50
Definition: Material.h:63
Definition: MeshNode.h:28
Definition: PipelineManager.h:54
Definition: Pipeline.h:20
Definition: PointLightNode.h:15
Definition: RenderSettings.h:45
Definition: RenderStatistics.h:11
FrameTemporaryStatistics frameTemporaryStatistics
Definition: RenderStatistics.h:200
Definition: Renderer.h:43
std::optional< Error > initializeResourceManagers()
Definition: Renderer.cpp:824
std::optional< Error > compileEngineShaders() const
Definition: Renderer.cpp:74
std::recursive_mutex mtxRwRenderResources
Definition: Renderer.h:822
virtual std::string getUsedApiVersion() const =0
LightingShaderResourceManager * getLightingShaderResourceManager() const
Definition: Renderer.cpp:721
ShaderTextureResourceBindingManager * getShaderTextureResourceManager() const
Definition: Renderer.cpp:717
void resetLightingShaderResourceManager()
Definition: Renderer.cpp:284
std::unique_ptr< GpuResourceManager > pResourceManager
Definition: Renderer.h:825
void drawNextFrame()
Definition: Renderer.cpp:307
virtual void prepareRenderTargetForNextFrame()
Definition: Renderer.h:528
std::unique_ptr< ShaderManager > pShaderManager
Definition: Renderer.h:828
std::pair< std::recursive_mutex *, RenderSettings * > getRenderSettings()
Definition: Renderer.cpp:689
size_t getUsedVideoMemoryInMb() const
Definition: Renderer.cpp:699
virtual void executeComputeShadersOnGraphicsQueue(FrameResource *pCurrentFrameResource, size_t iCurrentFrameResourceIndex, ComputeExecutionStage stage)=0
std::pair< std::mutex, FrameConstants > mtxFrameConstants
Definition: Renderer.h:864
virtual RendererType getType() const =0
static void getDirectionalLightNodeShadowMappingInfo(DirectionalLightNode *pNode, ShadowMapHandle *&pShadowMapHandle, unsigned int &iShadowPassLightInfoArrayIndex)
Definition: Renderer.cpp:1176
GameManager * pGameManager
Definition: Renderer.h:870
virtual std::pair< unsigned int, unsigned int > getRenderTargetSize() const =0
PipelineManager * getPipelineManager() const
Definition: Renderer.cpp:707
static std::variant< std::unique_ptr< Renderer >, Error > create(GameManager *pGameManager, std::optional< RendererType > preferredRenderer)
Definition: Renderer.cpp:616
std::unique_ptr< ShaderTextureResourceBindingManager > pShaderTextureResourceManager
Definition: Renderer.h:840
virtual void present(FrameResource *pCurrentFrameResource, size_t iCurrentFrameResourceIndex)=0
void resetFrameResourceManager()
Definition: Renderer.cpp:274
virtual std::optional< Error > onRenderSettingsChangedDerived()=0
void setupRenderStats()
Definition: Renderer.cpp:731
virtual void drawShadowMappingPass(FrameResource *pCurrentFrameResource, size_t iCurrentFrameResourceIndex, GraphicsPipelineRegistry *pGraphicsPipelines)=0
void updateFrameConstantsBuffer(FrameResource *pCurrentFrameResource, CameraProperties *pCameraProperties)
Definition: Renderer.cpp:164
virtual std::variant< std::optional< AntialiasingQuality >, Error > getMaxSupportedAntialiasingQuality() const =0
Window * getWindow() const
Definition: Renderer.cpp:701
void cullLightsOutsideCameraFrustum(CameraProperties *pActiveCameraProperties, size_t iCurrentFrameResourceIndex)
Definition: Renderer.cpp:1055
std::atomic< size_t > * getDrawCallCounter()
Definition: Renderer.h:729
MeshesInFrustum meshesInFrustumLastFrame
Definition: Renderer.h:855
void updateResourcesForNextFrame(unsigned int iRenderTargetWidth, unsigned int iRenderTargetHeight, CameraProperties *pCameraProperties)
Definition: Renderer.cpp:870
FrameResourceManager * getFrameResourceManager() const
Definition: Renderer.cpp:711
void onActiveCameraChanged()
Definition: Renderer.cpp:469
std::optional< Error > initializeRenderer()
Definition: Renderer.cpp:814
virtual void onFramebufferSizeChangedDerived(int iWidth, int iHeight)
Definition: Renderer.h:517
virtual void waitForGpuToFinishUsingFrameResource(FrameResource *pFrameResource)=0
std::pair< std::mutex, FrameConstants > * getFrameConstants()
Definition: Renderer.h:718
size_t getTotalVideoMemoryInMb() const
Definition: Renderer.cpp:695
static std::unique_ptr< Renderer > createRenderer(GameManager *pGameManager, std::optional< RendererType > preferredRenderer)
Definition: Renderer.cpp:481
GpuResourceManager * getResourceManager() const
Definition: Renderer.cpp:709
std::recursive_mutex * getRenderResourcesMutex()
Definition: Renderer.cpp:729
void calculateFrameStatistics()
Definition: Renderer.cpp:187
static consteval unsigned int getRecommendedSwapChainBufferCount()
Definition: Renderer.h:382
virtual bool isInitialized() const =0
std::optional< Error > initializeRenderSettings()
Definition: Renderer.cpp:772
std::unique_ptr< FrameResourceManager > pFrameResourceManager
Definition: Renderer.h:834
std::optional< Error > recalculateLightTileFrustums()
Definition: Renderer.cpp:431
virtual void waitForGpuToFinishWorkUpToThisPoint()=0
std::unique_ptr< GlobalShaderResourceBindingManager > pGlobalShaderResourceBindingManager
Definition: Renderer.h:846
static ShadowMapHandle * getPointLightNodeShadowMapHandle(PointLightNode *pNode)
Definition: Renderer.cpp:1197
std::unique_ptr< ShaderCpuWriteResourceBindingManager > pShaderCpuWriteResourceManager
Definition: Renderer.h:837
GlobalShaderResourceBindingManager * getGlobalShaderResourceBindingManager() const
Definition: Renderer.cpp:725
ShaderManager * getShaderManager() const
Definition: Renderer.cpp:705
std::pair< std::recursive_mutex, std::unique_ptr< RenderSettings > > mtxRenderSettings
Definition: Renderer.h:852
static constexpr float getMaxDepth()
Definition: Renderer.h:76
virtual std::variant< std::set< std::pair< unsigned int, unsigned int > >, Error > getSupportedRefreshRates() const =0
GameManager * getGameManager() const
Definition: Renderer.cpp:703
void resetGpuResourceManager()
Definition: Renderer.cpp:254
virtual std::vector< std::string > getSupportedGpuNames() const =0
static constexpr float minDepth
Definition: Renderer.h:876
RenderStatistics * getRenderStatistics()
Definition: Renderer.cpp:693
std::optional< Error > onRenderSettingsChanged(bool bShadowMapSizeChanged=false)
Definition: Renderer.cpp:399
virtual std::string getCurrentlyUsedGpuName() const =0
void recalculateTargetFrameTimeFromFpsLimitSetting()
Definition: Renderer.cpp:600
RenderStatistics renderStats
Definition: Renderer.h:867
std::optional< Error > clampSettingsToMaxSupported()
Definition: Renderer.cpp:858
static void getSpotlightNodeShadowMappingInfo(SpotlightNode *pNode, ShadowMapHandle *&pShadowMapHandle, unsigned int &iShadowPassLightInfoArrayIndex)
Definition: Renderer.cpp:1184
virtual GpuResource * getDepthTextureNoMultisampling()=0
void onFramebufferSizeChanged(int iWidth, int iHeight)
Definition: Renderer.cpp:294
std::unique_ptr< PipelineManager > pPipelineManager
Definition: Renderer.h:831
static constexpr float maxDepth
Definition: Renderer.h:879
virtual void prepareForDrawingNextFrame(CameraProperties *pCameraProperties, FrameResource *pCurrentFrameResource)=0
virtual void drawMeshesDepthPrepass(FrameResource *pCurrentFrameResource, size_t iCurrentFrameResourceIndex, const std::vector< Renderer::MeshesInFrustum::PipelineInFrustumInfo > &vOpaquePipelines)=0
static constexpr unsigned int iRecommendedSwapChainBufferCount
Definition: Renderer.h:873
static unsigned int getPointLightShadowPassLightInfoArrayIndex(PointLightNode *pNode, size_t iCubemapFaceIndex)
Definition: Renderer.cpp:1193
void resetPipelineManager()
Definition: Renderer.cpp:264
virtual std::variant< std::set< std::pair< unsigned int, unsigned int > >, Error > getSupportedRenderResolutions() const =0
virtual void drawMeshesMainPass(FrameResource *pCurrentFrameResource, size_t iCurrentFrameResourceIndex, const std::vector< Renderer::MeshesInFrustum::PipelineInFrustumInfo > &vOpaquePipelines, const std::vector< Renderer::MeshesInFrustum::PipelineInFrustumInfo > &vTransparentPipelines)=0
std::unique_ptr< LightingShaderResourceManager > pLightingShaderResourceManager
Definition: Renderer.h:843
MeshesInFrustum * getMeshesInCameraFrustum(CameraProperties *pActiveCameraProperties, GraphicsPipelineRegistry *pGraphicsPipelines)
Definition: Renderer.cpp:942
bool bIsWindowMinimized
Definition: Renderer.h:858
ShaderCpuWriteResourceBindingManager * getShaderCpuWriteResourceManager() const
Definition: Renderer.cpp:713
static constexpr float getMinDepth()
Definition: Renderer.h:69
std::pair< std::mutex, EnvironmentNode * > mtxSpawnedEnvironmentNode
Definition: Renderer.h:861
Definition: ShaderCpuWriteResourceBindingManager.h:21
Definition: ShaderManager.h:25
Definition: ShaderTextureResourceBindingManager.h:27
Definition: ShadowMapHandle.h:23
Definition: SpotlightNode.h:15
Definition: FrameResource.h:15
Definition: PipelineRegistry.hpp:31
std::atomic< size_t > iDrawCallCount
Definition: RenderStatistics.h:178
Definition: Renderer.h:357
std::pair< std::recursive_mutex *, ShaderLightsInFrustumSingleType * > mtxPointLightsInFrustum
Definition: Renderer.h:359
std::pair< std::recursive_mutex *, ShaderLightsInFrustumSingleType * > mtxSpotlightsInFrustum
Definition: Renderer.h:362
Definition: Renderer.h:332
Material * pMaterial
Definition: Renderer.h:334
std::vector< MeshInFrustumInfo > vMeshes
Definition: Renderer.h:337
Definition: Renderer.h:323
std::vector< MeshIndexBufferInfo > vIndexBuffers
Definition: Renderer.h:328
MeshNode * pMeshNode
Definition: Renderer.h:325
Definition: Renderer.h:341
Pipeline * pPipeline
Definition: Renderer.h:343
std::vector< MaterialInFrustumInfo > vMaterials
Definition: Renderer.h:346
Definition: Renderer.h:321
std::vector< PipelineInFrustumInfo > vOpaquePipelines
Definition: Renderer.h:350
std::vector< PipelineInFrustumInfo > vTransparentPipelines
Definition: Renderer.h:353