Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::RenderPassExecutor Class Reference

#include <RenderPassExecutor.h>

Classes

struct  BufferMaterialData
 
struct  BufferTransformData
 
struct  BufferUpdateRange
 
struct  ExecutorBuffer
 
struct  ExecutorBufferRange
 

Public Types

using NodeIndirectionData = vec4< U32 >
 
using BufferIndirectionData = std::array< NodeIndirectionData, MAX_INDIRECTION_ENTRIES >
 

Public Member Functions

 RenderPassExecutor (RenderPassManager &parent, GFXDevice &context, RenderStage stage)
 
void doCustomPass (PlayerIndex idx, Camera *camera, RenderPassParams params, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
 
void postInit (Handle< ShaderProgram > OITCompositionShader, Handle< ShaderProgram > OITCompositionShaderMS, Handle< ShaderProgram > ResolveGBufferShaderMS)
 
void postRender ()
 

Static Public Member Functions

static void OnStartup (const GFXDevice &gfx)
 
static void OnShutdown (const GFXDevice &gfx)
 

Static Public Attributes

static constexpr size_t INVALID_MAT_HASH = SIZE_MAX
 
static constexpr size_t INVALID_TEX_HASH = SIZE_MAX
 
static constexpr U16 g_invalidMaterialIndex = Config::MAX_CONCURRENT_MATERIALS
 
static constexpr U32 g_invalidTexturesIndex = g_invalidMaterialIndex
 
static constexpr U8 TRANSFORM_IDX = 0u
 
static constexpr U8 MATERIAL_IDX = 1u
 
static constexpr U8 TEXTURES_IDX = 2u
 
static constexpr U8 SELECTION_FLAG = 3u
 
static constexpr U32 MAX_INDIRECTION_ENTRIES = (2 * 1024 * 1024) / sizeof(NodeIndirectionData)
 

Private Member Functions

void prePass (const RenderPassParams &params, const CameraSnapshot &cameraSnapshot, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
 
void occlusionPass (PlayerIndex idx, const CameraSnapshot &cameraSnapshot, size_t visibleNodeCount, const RenderTargetID &sourceDepthBuffer, const RenderTargetID &targetHiZBuffer, GFX::CommandBuffer &bufferInOut) const
 
void mainPass (const RenderPassParams &params, const CameraSnapshot &cameraSnapshot, RenderTarget &target, bool prePassExecuted, bool hasHiZ, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
 
void transparencyPass (const RenderPassParams &params, const CameraSnapshot &cameraSnapshot, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
 
void woitPass (const RenderPassParams &params, const CameraSnapshot &cameraSnapshot, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
 
void prepareRenderQueues (const RenderPassParams &params, const CameraSnapshot &cameraSnapshot, bool transparencyPass, RenderingOrder renderOrder, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
 
void processVisibleNodeTransform (PlayerIndex index, RenderingComponent *rComp)
 
U16 processVisibleNodeMaterial (RenderingComponent *rComp, bool &cacheHit)
 
size_t buildDrawCommands (PlayerIndex index, const RenderPassParams &params, bool doPrePass, bool doOITPass, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
 
size_t prepareNodeData (PlayerIndex index, const RenderPassParams &params, const CameraSnapshot &cameraSnapshot, bool hasInvalidNodes, const bool doPrePass, const bool doOITPass, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
 
U32 renderQueueSize () const
 
void resolveMainScreenTarget (const RenderPassParams &params, GFX::CommandBuffer &bufferInOut) const
 
bool validateNodesForStagePass (RenderStagePass stagePass)
 
void parseMaterialRange (RenderBin::SortedQueue &queue, U32 start, U32 end)
 

Static Private Member Functions

static void OnRenderingComponentCreation (RenderingComponent *rComp)
 
static void OnRenderingComponentDestruction (RenderingComponent *rComp)
 

Private Attributes

RenderPassManager_parent
 
GFXDevice_context
 
const RenderStage _stage
 
bool _lightsUploaded = false
 
RenderQueue_uptr _renderQueue {nullptr}
 
RenderBin::SortedQueues _sortedQueues {}
 
DrawCommandContainer _drawCommands {}
 
RenderQueuePackages _renderQueuePackages {}
 
ShaderBuffer_uptr _cmdBuffer
 
ExecutorBuffer< BufferMaterialData_materialBuffer
 
ExecutorBuffer< BufferTransformData_transformBuffer
 
ExecutorBuffer< BufferIndirectionData_indirectionBuffer
 
VisibleNodeList _visibleNodesCache
 

Static Private Attributes

static bool s_globalDataInit = false
 
static std::array< bool, MAX_INDIRECTION_ENTRIESs_indirectionFreeList {}
 
static Mutex s_indirectionGlobalLock
 
static Pipelines_OITCompositionPipeline = nullptr
 
static Pipelines_OITCompositionMSPipeline = nullptr
 
static Pipelines_ResolveGBufferPipeline = nullptr
 

Friends

class RenderingComponent
 

Detailed Description

Definition at line 60 of file RenderPassExecutor.h.

Member Typedef Documentation

◆ BufferIndirectionData

◆ NodeIndirectionData

Constructor & Destructor Documentation

◆ RenderPassExecutor()

Divide::RenderPassExecutor::RenderPassExecutor ( RenderPassManager parent,
GFXDevice context,
RenderStage  stage 
)
explicit

Definition at line 282 of file RenderPassExecutor.cpp.

Member Function Documentation

◆ buildDrawCommands()

size_t Divide::RenderPassExecutor::buildDrawCommands ( PlayerIndex  index,
const RenderPassParams params,
bool  doPrePass,
bool  doOITPass,
GFX::CommandBuffer bufferInOut,
GFX::MemoryBarrierCommand memCmdInOut 
)
private

Definition at line 595 of file RenderPassExecutor.cpp.

◆ doCustomPass()

void Divide::RenderPassExecutor::doCustomPass ( PlayerIndex  idx,
Camera camera,
RenderPassParams  params,
GFX::CommandBuffer bufferInOut,
GFX::MemoryBarrierCommand memCmdInOut 
)

Definition at line 1203 of file RenderPassExecutor.cpp.

◆ mainPass()

void Divide::RenderPassExecutor::mainPass ( const RenderPassParams params,
const CameraSnapshot cameraSnapshot,
RenderTarget target,
bool  prePassExecuted,
bool  hasHiZ,
GFX::CommandBuffer bufferInOut,
GFX::MemoryBarrierCommand memCmdInOut 
)
private

Definition at line 1021 of file RenderPassExecutor.cpp.

◆ occlusionPass()

void Divide::RenderPassExecutor::occlusionPass ( PlayerIndex  idx,
const CameraSnapshot cameraSnapshot,
size_t  visibleNodeCount,
const RenderTargetID sourceDepthBuffer,
const RenderTargetID targetHiZBuffer,
GFX::CommandBuffer bufferInOut 
) const
private

Definition at line 983 of file RenderPassExecutor.cpp.

◆ OnRenderingComponentCreation()

void Divide::RenderPassExecutor::OnRenderingComponentCreation ( RenderingComponent rComp)
staticprivate

Definition at line 1425 of file RenderPassExecutor.cpp.

◆ OnRenderingComponentDestruction()

void Divide::RenderPassExecutor::OnRenderingComponentDestruction ( RenderingComponent rComp)
staticprivate

Definition at line 1445 of file RenderPassExecutor.cpp.

◆ OnShutdown()

void Divide::RenderPassExecutor::OnShutdown ( const GFXDevice gfx)
static

Definition at line 307 of file RenderPassExecutor.cpp.

◆ OnStartup()

void Divide::RenderPassExecutor::OnStartup ( const GFXDevice gfx)
static

Definition at line 300 of file RenderPassExecutor.cpp.

◆ parseMaterialRange()

void Divide::RenderPassExecutor::parseMaterialRange ( RenderBin::SortedQueue queue,
U32  start,
U32  end 
)
private

Definition at line 543 of file RenderPassExecutor.cpp.

◆ postInit()

void Divide::RenderPassExecutor::postInit ( Handle< ShaderProgram OITCompositionShader,
Handle< ShaderProgram OITCompositionShaderMS,
Handle< ShaderProgram ResolveGBufferShaderMS 
)

Definition at line 317 of file RenderPassExecutor.cpp.

◆ postRender()

void Divide::RenderPassExecutor::postRender ( )

Definition at line 1397 of file RenderPassExecutor.cpp.

◆ prepareNodeData()

size_t Divide::RenderPassExecutor::prepareNodeData ( PlayerIndex  index,
const RenderPassParams params,
const CameraSnapshot cameraSnapshot,
bool  hasInvalidNodes,
const bool  doPrePass,
const bool  doOITPass,
GFX::CommandBuffer bufferInOut,
GFX::MemoryBarrierCommand memCmdInOut 
)
private

Definition at line 784 of file RenderPassExecutor.cpp.

◆ prepareRenderQueues()

void Divide::RenderPassExecutor::prepareRenderQueues ( const RenderPassParams params,
const CameraSnapshot cameraSnapshot,
bool  transparencyPass,
RenderingOrder  renderOrder,
GFX::CommandBuffer bufferInOut,
GFX::MemoryBarrierCommand memCmdInOut 
)
private

Definition at line 864 of file RenderPassExecutor.cpp.

◆ prePass()

void Divide::RenderPassExecutor::prePass ( const RenderPassParams params,
const CameraSnapshot cameraSnapshot,
GFX::CommandBuffer bufferInOut,
GFX::MemoryBarrierCommand memCmdInOut 
)
private

Definition at line 960 of file RenderPassExecutor.cpp.

◆ processVisibleNodeMaterial()

U16 Divide::RenderPassExecutor::processVisibleNodeMaterial ( RenderingComponent rComp,
bool &  cacheHit 
)
private

Definition at line 461 of file RenderPassExecutor.cpp.

◆ processVisibleNodeTransform()

void Divide::RenderPassExecutor::processVisibleNodeTransform ( PlayerIndex  index,
RenderingComponent rComp 
)
private

Definition at line 382 of file RenderPassExecutor.cpp.

◆ renderQueueSize()

U32 Divide::RenderPassExecutor::renderQueueSize ( ) const
private

Definition at line 1420 of file RenderPassExecutor.cpp.

◆ resolveMainScreenTarget()

void Divide::RenderPassExecutor::resolveMainScreenTarget ( const RenderPassParams params,
GFX::CommandBuffer bufferInOut 
) const
private

Definition at line 1153 of file RenderPassExecutor.cpp.

◆ transparencyPass()

void Divide::RenderPassExecutor::transparencyPass ( const RenderPassParams params,
const CameraSnapshot cameraSnapshot,
GFX::CommandBuffer bufferInOut,
GFX::MemoryBarrierCommand memCmdInOut 
)
private

Definition at line 1136 of file RenderPassExecutor.cpp.

◆ validateNodesForStagePass()

bool Divide::RenderPassExecutor::validateNodesForStagePass ( RenderStagePass  stagePass)
private

Definition at line 1185 of file RenderPassExecutor.cpp.

◆ woitPass()

void Divide::RenderPassExecutor::woitPass ( const RenderPassParams params,
const CameraSnapshot cameraSnapshot,
GFX::CommandBuffer bufferInOut,
GFX::MemoryBarrierCommand memCmdInOut 
)
private

Definition at line 1071 of file RenderPassExecutor.cpp.

Friends And Related Function Documentation

◆ RenderingComponent

friend class RenderingComponent
friend

Definition at line 217 of file RenderPassExecutor.h.

Member Data Documentation

◆ _cmdBuffer

ShaderBuffer_uptr Divide::RenderPassExecutor::_cmdBuffer
private

Definition at line 233 of file RenderPassExecutor.h.

◆ _context

GFXDevice& Divide::RenderPassExecutor::_context
private

Definition at line 223 of file RenderPassExecutor.h.

◆ _drawCommands

DrawCommandContainer Divide::RenderPassExecutor::_drawCommands {}
private

Definition at line 230 of file RenderPassExecutor.h.

◆ _indirectionBuffer

ExecutorBuffer<BufferIndirectionData> Divide::RenderPassExecutor::_indirectionBuffer
private

Definition at line 237 of file RenderPassExecutor.h.

◆ _lightsUploaded

bool Divide::RenderPassExecutor::_lightsUploaded = false
private

Definition at line 226 of file RenderPassExecutor.h.

◆ _materialBuffer

ExecutorBuffer<BufferMaterialData> Divide::RenderPassExecutor::_materialBuffer
private

Definition at line 235 of file RenderPassExecutor.h.

◆ _parent

RenderPassManager& Divide::RenderPassExecutor::_parent
private

Definition at line 222 of file RenderPassExecutor.h.

◆ _renderQueue

RenderQueue_uptr Divide::RenderPassExecutor::_renderQueue {nullptr}
private

Definition at line 228 of file RenderPassExecutor.h.

◆ _renderQueuePackages

RenderQueuePackages Divide::RenderPassExecutor::_renderQueuePackages {}
private

Definition at line 231 of file RenderPassExecutor.h.

◆ _sortedQueues

RenderBin::SortedQueues Divide::RenderPassExecutor::_sortedQueues {}
private

Definition at line 229 of file RenderPassExecutor.h.

◆ _stage

const RenderStage Divide::RenderPassExecutor::_stage
private

Definition at line 224 of file RenderPassExecutor.h.

◆ _transformBuffer

ExecutorBuffer<BufferTransformData> Divide::RenderPassExecutor::_transformBuffer
private

Definition at line 236 of file RenderPassExecutor.h.

◆ _visibleNodesCache

VisibleNodeList Divide::RenderPassExecutor::_visibleNodesCache
private

Definition at line 238 of file RenderPassExecutor.h.

◆ g_invalidMaterialIndex

constexpr U16 Divide::RenderPassExecutor::g_invalidMaterialIndex = Config::MAX_CONCURRENT_MATERIALS
staticconstexpr

Definition at line 65 of file RenderPassExecutor.h.

◆ g_invalidTexturesIndex

constexpr U32 Divide::RenderPassExecutor::g_invalidTexturesIndex = g_invalidMaterialIndex
staticconstexpr

Definition at line 66 of file RenderPassExecutor.h.

◆ INVALID_MAT_HASH

constexpr size_t Divide::RenderPassExecutor::INVALID_MAT_HASH = SIZE_MAX
staticconstexpr

Definition at line 63 of file RenderPassExecutor.h.

◆ INVALID_TEX_HASH

constexpr size_t Divide::RenderPassExecutor::INVALID_TEX_HASH = SIZE_MAX
staticconstexpr

Definition at line 64 of file RenderPassExecutor.h.

◆ MATERIAL_IDX

constexpr U8 Divide::RenderPassExecutor::MATERIAL_IDX = 1u
staticconstexpr

Definition at line 82 of file RenderPassExecutor.h.

◆ MAX_INDIRECTION_ENTRIES

constexpr U32 Divide::RenderPassExecutor::MAX_INDIRECTION_ENTRIES = (2 * 1024 * 1024) / sizeof(NodeIndirectionData)
staticconstexpr

Definition at line 87 of file RenderPassExecutor.h.

◆ s_globalDataInit

bool Divide::RenderPassExecutor::s_globalDataInit = false
staticprivate

Definition at line 240 of file RenderPassExecutor.h.

◆ s_indirectionFreeList

std::array< bool, RenderPassExecutor::MAX_INDIRECTION_ENTRIES > Divide::RenderPassExecutor::s_indirectionFreeList {}
staticprivate

Definition at line 241 of file RenderPassExecutor.h.

◆ s_indirectionGlobalLock

Mutex Divide::RenderPassExecutor::s_indirectionGlobalLock
staticprivate

Definition at line 242 of file RenderPassExecutor.h.

◆ s_OITCompositionMSPipeline

Pipeline * Divide::RenderPassExecutor::s_OITCompositionMSPipeline = nullptr
staticprivate

Definition at line 244 of file RenderPassExecutor.h.

◆ s_OITCompositionPipeline

Pipeline * Divide::RenderPassExecutor::s_OITCompositionPipeline = nullptr
staticprivate

Definition at line 243 of file RenderPassExecutor.h.

◆ s_ResolveGBufferPipeline

Pipeline * Divide::RenderPassExecutor::s_ResolveGBufferPipeline = nullptr
staticprivate

Definition at line 245 of file RenderPassExecutor.h.

◆ SELECTION_FLAG

constexpr U8 Divide::RenderPassExecutor::SELECTION_FLAG = 3u
staticconstexpr

Definition at line 84 of file RenderPassExecutor.h.

◆ TEXTURES_IDX

constexpr U8 Divide::RenderPassExecutor::TEXTURES_IDX = 2u
staticconstexpr

Definition at line 83 of file RenderPassExecutor.h.

◆ TRANSFORM_IDX

constexpr U8 Divide::RenderPassExecutor::TRANSFORM_IDX = 0u
staticconstexpr

Definition at line 81 of file RenderPassExecutor.h.


The documentation for this class was generated from the following files: