Nebula
Loading...
Searching...
No Matches
Graphics Namespace Reference

Detailed Description

Implements the shader server used by Vulkan.

Classes

struct  BindlessRegistryCreateInfo
class  CameraContext
 Handles cameras. More...
class  CameraSettings
class  EnvironmentContext
 The environment context deals with anything related to the sky and atmosphere effects. More...
struct  GlobalConstantsCreateInfo
struct  GraphicsContextFunctionBundle
struct  ContextEntityId
struct  GraphicsContextState
 A graphics context is a resource which holds a contextual representation for a graphics entity. More...
class  GraphicsContext
class  GraphicsDisplayEventHandler
 Handles DisplayEvents that are relevant for the graphics system. More...
struct  GraphicsEntityId
 The graphics entity is only an Id, to which we can attach GraphicsContexts. More...
struct  FrameContext
class  GraphicsServer
 The graphics server is the main singleton for the Graphics subsystem. More...
struct  ViewId
struct  ViewCreateInfo
class  LightProbeContext
 Adds a light probe component to graphics entities. More...

Typedefs

typedef uint32_t BindlessIndex
using ViewIndependentCall = void(*)(const Graphics::FrameContext& ctx)
using ViewDependentCall = void(*)(const ViewId view, const Graphics::FrameContext& ctx)
typedef uint16_t StageMask
typedef Ids::IdAllocator< Shared::ViewConstants::STRUCT, Shared::ShadowViewConstants::STRUCT, CoreGraphics::TextureId, Math::rectangle< int >, Graphics::StageMask, bool(*)(const Math::rectangle< int > &viewport, IndexT frameIndex, IndexT bufferIndex), GraphicsEntityId, bool > ViewAllocator

Enumerations

enum class  GlobalTables { GraphicsQueue , ComputeQueue , NumQueues }
enum  {
  View_ViewConstants , View_ShadowConstants , View_OutputTarget , View_Viewport ,
  View_StageMask , View_FrameScriptFunc , View_Camera , View_Enabled
}

Functions

void CreateBindlessRegistry (const BindlessRegistryCreateInfo &info)
 Create bindless registry.
void DestroyBindlessRegistry ()
 Destroy bindless registry.
BindlessIndex RegisterTexture (const CoreGraphics::TextureId &tex, CoreGraphics::TextureType type, bool depth=false, bool stencil=false)
 Register texture.
void ReregisterTexture (const CoreGraphics::TextureId &tex, CoreGraphics::TextureType type, BindlessIndex id, bool depth=false, bool stencil=false)
 Reregister texture on the same slot.
void UnregisterTexture (const BindlessIndex id, const CoreGraphics::TextureType type)
 Unregister texture.
 __ImplementContext (CameraContext, CameraContext::cameraAllocator)
 __ImplementPluginContext (EnvironmentContext)
Math::vec4 CalculateZenithLuminanceYxy (float t, float thetaS)
void CalculatePerezDistribution (float t, Math::vec4 &A, Math::vec4 &B, Math::vec4 &C, Math::vec4 &D, Math::vec4 &E)
void CreateGlobalConstants (const GlobalConstantsCreateInfo &info)
 Create global constants.
void DestroyGlobalConstants ()
 Destroy global constants.
void AllocateGlobalConstants ()
 Run when starting frame.
void UpdateTickParams (const Shared::PerTickParams::STRUCT &tickParams)
 Set tick params.
void UpdateViewConstants (const Shared::ViewConstants::STRUCT &viewConstants)
 Set view params.
void UpdateShadowConstants (const Shared::ShadowViewConstants::STRUCT &shadowViewConstants)
 Set camera params.
void FlushUpdates (const CoreGraphics::CmdBufferId buf, const CoreGraphics::QueueType queue)
 Flush constants by recording update command to command buffer.
void GetOffsets (uint64_t &tickOffset, uint64_t &viewOffset, uint64_t &shadowOffset, const GlobalTables table)
 Get frame constant offsets.
const Shared::PerTickParams::STRUCT & GetTickParams ()
 Get tick params constant buffer.
void SetGlobalEnvironmentTextures (const CoreGraphics::TextureId &env, const CoreGraphics::TextureId &irr, const SizeT numMips)
 Set global irradiance and cubemaps.
void SetupBufferConstants ()
 Setup gbuffer bindings.
const CoreGraphics::ResourceTableId GetFrameResourceTable (uint32_t bufferIndex, GlobalTables table)
 Get per-tick resource table for queue.
const std::array< CoreGraphics::ResourceTableId,(uint) GlobalTables::NumQueuesGetFrameResourceTables (uint32_t bufferIndex)
 Get per-tick resource tables for all queues.
const CoreGraphics::ResourceTableId GetTickResourceTable (uint32_t bufferIndex, GlobalTables table)
 Get per-tick resource table for queue.
const std::array< CoreGraphics::ResourceTableId,(uint) GlobalTables::NumQueuesGetTickResourceTables (uint32_t bufferIndex)
 Get per-tick resource table for all queues.
const std::array< CoreGraphics::QueueType,(uint) GlobalTables::NumQueuesGetTableQueues ()
 Get the different per-queue resource tables.
 __ImplementClass (Graphics::GraphicsDisplayEventHandler, 'WGEH', CoreGraphics::DisplayEventHandler)
 __ImplementClass (Graphics::GraphicsServer, 'GFXS', Core::RefCounted)
 __ImplementSingleton (Graphics::GraphicsServer)
static GraphicsEntityId CreateEntity ()
static void DestroyEntity (const GraphicsEntityId id)
template<typename ... CONTEXTS>
static void RegisterEntity (const GraphicsEntityId id)
template<typename ... CONTEXTS>
static void DeregisterEntity (const GraphicsEntityId id)
template<typename ... CONTEXTS>
static void DeregisterEntityImmediate (const GraphicsEntityId id)
ViewId CreateView (const ViewCreateInfo &info)
 Create a new view.
void DestroyView (const ViewId id)
 Destroy view.
void ViewApply (const ViewId id)
 Apply view.
bool ViewRender (const ViewId id, const IndexT frameIndex, const Timing::Time time, const IndexT bufferIndex)
 Render view.
void ViewSetFrameScript (const ViewId id, bool(*func)(const Math::rectangle< int > &viewport, IndexT frameIndex, IndexT bufferIndex))
 Set view frame script.
void ViewSetViewport (const ViewId id, const Math::rectangle< int > &rect)
 Set view viewport.
const Math::rectangle< int > & ViewGetViewport (const ViewId id)
 Get view viewport.
void ViewSetCamera (const ViewId id, const GraphicsEntityId &camera)
 Set view camera.
const GraphicsEntityIdViewGetCamera (const ViewId id)
 Get view camera.
Shared::ViewConstants::STRUCT & ViewGetViewConstants (const ViewId id)
 Get view constants.
Shared::ShadowViewConstants::STRUCT & ViewGetShadowConstants (const ViewId id)
 Get shadow view constants.
void ViewSetStageMask (const ViewId id, const Graphics::StageMask stage)
 Set view stage.
const Graphics::StageMask ViewGetStageMask (const ViewId id)
 Get view stage.
void ViewEnable (const ViewId id)
 Enable view.
void ViewDisable (const ViewId id)
 Disable view.
bool ViewIsEnabled (const ViewId id)
 Check if view is enabled.
static constexpr StageMask StageMaskFromIndex (const IndexT stageIndex)
 __ImplementContext (LightProbeContext, LightProbeContext::lightProbeAllocator)

Variables

struct { 
   Util::FixedPool< uint32_t >   Graphics::texturePool 
   Threading::CriticalSection   Graphics::bindResourceCriticalSection 
state
struct { 
   Graphics::GraphicsEntityId   Graphics::skyBoxEntity 
   Graphics::GraphicsEntityId   Graphics::sunEntity 
   Math::vec4   Graphics::bloomColor 
   float   Graphics::bloomIntensity 
   float   Graphics::maxEyeLuminance 
   Math::vec4   Graphics::fogColor 
   float   Graphics::fogDistances [2] 
   int   Graphics::numGlobalEnvironmentMips 
   float   Graphics::saturation 
   float   Graphics::fadeValue 
   float   Graphics::skyTurbidity 
   CoreGraphics::TextureId   Graphics::defaultEnvironmentMap 
   CoreGraphics::TextureId   Graphics::defaultIrradianceMap 
   Core::CVar *   Graphics::r_show_env_params 
envState
struct { 
   Util::FixedArray< CoreGraphics::ResourceTableId >   Graphics::frameResourceTables [(uint) GlobalTables::NumQueues
   Util::FixedArray< CoreGraphics::ResourceTableId >   Graphics::tickResourceTables [(uint) GlobalTables::NumQueues
   CoreGraphics::ResourcePipelineId   Graphics::tableLayout 
   Shared::PerTickParams::STRUCT   Graphics::tickParams 
   union DirtySet
      struct { 
         bool   Graphics::graphicsDirty: 1 
         bool   Graphics::computeDirty: 1 
      } 
      int   Graphics::bits 
   } 
   DirtySet   Graphics::tickParamsDirty 
   uint64_t   Graphics::tickCboOffset [(uint) GlobalTables::NumQueues
   uint64_t   Graphics::viewCboOffset [(uint) GlobalTables::NumQueues
   uint64_t   Graphics::shadowViewCboOffset [(uint) GlobalTables::NumQueues
   Shared::ViewConstants::STRUCT   Graphics::viewConstants 
   Shared::ShadowViewConstants::STRUCT   Graphics::shadowViewConstants 
   DirtySet   Graphics::viewConstantsDirty 
   DirtySet   Graphics::shadowViewConstantsDirty 
globalConstantState
ViewAllocator viewAllocator
static constexpr StageMask PRIMARY_STAGE_MASK = 0x1
static constexpr StageMask SHADOW_STAGE_MASK = 0x2
static constexpr StageMask DEFAULT_STAGE_MASK = PRIMARY_STAGE_MASK | SHADOW_STAGE_MASK
static constexpr StageMask ALL_STAGE_MASK = 0xFFFF

Typedef Documentation

◆ BindlessIndex

typedef uint32_t Graphics::BindlessIndex

◆ StageMask

typedef uint16_t Graphics::StageMask

◆ ViewAllocator

typedef Ids::IdAllocator< Shared::ViewConstants::STRUCT, Shared::ShadowViewConstants::STRUCT, CoreGraphics::TextureId, Math::rectangle<int>, Graphics::StageMask, bool (*)(const Math::rectangle<int>& viewport, IndexT frameIndex, IndexT bufferIndex), GraphicsEntityId, bool> Graphics::ViewAllocator

◆ ViewDependentCall

using Graphics::ViewDependentCall = void(*)(const ViewId view, const Graphics::FrameContext& ctx)

◆ ViewIndependentCall

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
View_ViewConstants 
View_ShadowConstants 
View_OutputTarget 
View_Viewport 
View_StageMask 
View_FrameScriptFunc 
View_Camera 
View_Enabled 

◆ GlobalTables

enum class Graphics::GlobalTables
strong
Enumerator
GraphicsQueue 
ComputeQueue 
NumQueues 

Function Documentation

◆ __ImplementClass() [1/2]

◆ __ImplementClass() [2/2]

◆ __ImplementContext() [1/2]

Graphics::__ImplementContext ( CameraContext ,
CameraContext::cameraAllocator  )

◆ __ImplementContext() [2/2]

Graphics::__ImplementContext ( LightProbeContext ,
LightProbeContext::lightProbeAllocator  )

◆ __ImplementPluginContext()

Graphics::__ImplementPluginContext ( EnvironmentContext )

◆ __ImplementSingleton()

◆ AllocateGlobalConstants()

void Graphics::AllocateGlobalConstants ( )

Run when starting frame.

◆ CalculatePerezDistribution()

void Graphics::CalculatePerezDistribution ( float t,
Math::vec4 & A,
Math::vec4 & B,
Math::vec4 & C,
Math::vec4 & D,
Math::vec4 & E )

◆ CalculateZenithLuminanceYxy()

Math::vec4 Graphics::CalculateZenithLuminanceYxy ( float t,
float thetaS )

◆ CreateBindlessRegistry()

void Graphics::CreateBindlessRegistry ( const BindlessRegistryCreateInfo & info)

Create bindless registry.

◆ CreateEntity()

GraphicsEntityId Graphics::CreateEntity ( )
static

◆ CreateGlobalConstants()

void Graphics::CreateGlobalConstants ( const GlobalConstantsCreateInfo & info)

Create global constants.

◆ CreateView()

ViewId Graphics::CreateView ( const ViewCreateInfo & info)

Create a new view.

◆ DeregisterEntity()

template<typename ... CONTEXTS>
void Graphics::DeregisterEntity ( const GraphicsEntityId id)
static

◆ DeregisterEntityImmediate()

template<typename ... CONTEXTS>
void Graphics::DeregisterEntityImmediate ( const GraphicsEntityId id)
static

◆ DestroyBindlessRegistry()

void Graphics::DestroyBindlessRegistry ( )

Destroy bindless registry.

◆ DestroyEntity()

void Graphics::DestroyEntity ( const GraphicsEntityId id)
static

◆ DestroyGlobalConstants()

void Graphics::DestroyGlobalConstants ( )

Destroy global constants.

◆ DestroyView()

void Graphics::DestroyView ( const ViewId id)

Destroy view.

◆ FlushUpdates()

void Graphics::FlushUpdates ( const CoreGraphics::CmdBufferId buf,
const CoreGraphics::QueueType queue )

Flush constants by recording update command to command buffer.

◆ GetFrameResourceTable()

const CoreGraphics::ResourceTableId Graphics::GetFrameResourceTable ( uint32_t bufferIndex,
GlobalTables table )

Get per-tick resource table for queue.

◆ GetFrameResourceTables()

const std::array< CoreGraphics::ResourceTableId,(uint) GlobalTables::NumQueues > Graphics::GetFrameResourceTables ( uint32_t bufferIndex)

Get per-tick resource tables for all queues.

◆ GetOffsets()

void Graphics::GetOffsets ( uint64_t & tickOffset,
uint64_t & viewOffset,
uint64_t & shadowOffset,
const GlobalTables table )

Get frame constant offsets.

◆ GetTableQueues()

const std::array< CoreGraphics::QueueType,(uint) GlobalTables::NumQueues > Graphics::GetTableQueues ( )

Get the different per-queue resource tables.

◆ GetTickParams()

const Shared::PerTickParams::STRUCT & Graphics::GetTickParams ( )

Get tick params constant buffer.

◆ GetTickResourceTable()

const CoreGraphics::ResourceTableId Graphics::GetTickResourceTable ( uint32_t bufferIndex,
GlobalTables table )

Get per-tick resource table for queue.

◆ GetTickResourceTables()

const std::array< CoreGraphics::ResourceTableId,(uint) GlobalTables::NumQueues > Graphics::GetTickResourceTables ( uint32_t bufferIndex)

Get per-tick resource table for all queues.

◆ RegisterEntity()

template<typename ... CONTEXTS>
void Graphics::RegisterEntity ( const GraphicsEntityId id)
static

◆ RegisterTexture()

BindlessIndex Graphics::RegisterTexture ( const CoreGraphics::TextureId & tex,
CoreGraphics::TextureType type,
bool depth,
bool stencil )

Register texture.

◆ ReregisterTexture()

void Graphics::ReregisterTexture ( const CoreGraphics::TextureId & tex,
CoreGraphics::TextureType type,
BindlessIndex index,
bool depth,
bool stencil )

Reregister texture on the same slot.

◆ SetGlobalEnvironmentTextures()

void Graphics::SetGlobalEnvironmentTextures ( const CoreGraphics::TextureId & env,
const CoreGraphics::TextureId & irr,
const SizeT numMips )

Set global irradiance and cubemaps.

◆ SetupBufferConstants()

void Graphics::SetupBufferConstants ( )

Setup gbuffer bindings.

◆ StageMaskFromIndex()

constexpr StageMask Graphics::StageMaskFromIndex ( const IndexT stageIndex)
staticconstexpr

◆ UnregisterTexture()

void Graphics::UnregisterTexture ( const BindlessIndex id,
const CoreGraphics::TextureType type )

Unregister texture.

◆ UpdateShadowConstants()

void Graphics::UpdateShadowConstants ( const Shared::ShadowViewConstants::STRUCT & shadowViewConstants)

Set camera params.

◆ UpdateTickParams()

void Graphics::UpdateTickParams ( const Shared::PerTickParams::STRUCT & tickParams)

Set tick params.

◆ UpdateViewConstants()

void Graphics::UpdateViewConstants ( const Shared::ViewConstants::STRUCT & viewConstants)

Set view params.

◆ ViewApply()

void Graphics::ViewApply ( const ViewId id)

Apply view.

◆ ViewDisable()

void Graphics::ViewDisable ( const ViewId id)

Disable view.

◆ ViewEnable()

void Graphics::ViewEnable ( const ViewId id)

Enable view.

◆ ViewGetCamera()

const GraphicsEntityId & Graphics::ViewGetCamera ( const ViewId id)

Get view camera.

◆ ViewGetShadowConstants()

Shared::ShadowViewConstants::STRUCT & Graphics::ViewGetShadowConstants ( const ViewId id)

Get shadow view constants.

◆ ViewGetStageMask()

const Graphics::StageMask Graphics::ViewGetStageMask ( const ViewId id)

Get view stage.

◆ ViewGetViewConstants()

Shared::ViewConstants::STRUCT & Graphics::ViewGetViewConstants ( const ViewId id)

Get view constants.

◆ ViewGetViewport()

const Math::rectangle< int > & Graphics::ViewGetViewport ( const ViewId id)

Get view viewport.

◆ ViewIsEnabled()

bool Graphics::ViewIsEnabled ( const ViewId id)

Check if view is enabled.

◆ ViewRender()

bool Graphics::ViewRender ( const ViewId id,
const IndexT frameIndex,
const Timing::Time time,
const IndexT bufferIndex )

Render view.

◆ ViewSetCamera()

void Graphics::ViewSetCamera ( const ViewId id,
const GraphicsEntityId & camera )

Set view camera.

◆ ViewSetFrameScript()

void Graphics::ViewSetFrameScript ( const ViewId id,
bool(* func )(const Math::rectangle< int > &viewport, IndexT frameIndex, IndexT bufferIndex) )

Set view frame script.

◆ ViewSetStageMask()

void Graphics::ViewSetStageMask ( const ViewId id,
const Graphics::StageMask stage )

Set view stage.

◆ ViewSetViewport()

void Graphics::ViewSetViewport ( const ViewId id,
const Math::rectangle< int > & rect )

Set view viewport.

Variable Documentation

◆ ALL_STAGE_MASK

StageMask Graphics::ALL_STAGE_MASK = 0xFFFF
staticconstexpr

◆ bindResourceCriticalSection

Threading::CriticalSection Graphics::bindResourceCriticalSection

◆ bits

int Graphics::bits

◆ bloomColor

Math::vec4 Graphics::bloomColor

◆ bloomIntensity

float Graphics::bloomIntensity

◆ computeDirty

bool Graphics::computeDirty

◆ DEFAULT_STAGE_MASK

StageMask Graphics::DEFAULT_STAGE_MASK = PRIMARY_STAGE_MASK | SHADOW_STAGE_MASK
staticconstexpr

◆ defaultEnvironmentMap

CoreGraphics::TextureId Graphics::defaultEnvironmentMap

◆ defaultIrradianceMap

CoreGraphics::TextureId Graphics::defaultIrradianceMap

◆ [struct]

struct { ... } Graphics::envState

◆ fadeValue

float Graphics::fadeValue

◆ fogColor

Math::vec4 Graphics::fogColor

◆ fogDistances

float Graphics::fogDistances[2]

◆ frameResourceTables

◆ [struct]

struct { ... } Graphics::globalConstantState

◆ graphicsDirty

bool Graphics::graphicsDirty

◆ maxEyeLuminance

float Graphics::maxEyeLuminance

◆ numGlobalEnvironmentMips

int Graphics::numGlobalEnvironmentMips

◆ PRIMARY_STAGE_MASK

StageMask Graphics::PRIMARY_STAGE_MASK = 0x1
staticconstexpr

◆ r_show_env_params

Core::CVar* Graphics::r_show_env_params

◆ saturation

float Graphics::saturation

◆ SHADOW_STAGE_MASK

StageMask Graphics::SHADOW_STAGE_MASK = 0x2
staticconstexpr

◆ shadowViewCboOffset

uint64_t Graphics::shadowViewCboOffset[(uint) GlobalTables::NumQueues]

◆ shadowViewConstants

Shared::ShadowViewConstants::STRUCT Graphics::shadowViewConstants

◆ shadowViewConstantsDirty

DirtySet Graphics::shadowViewConstantsDirty

◆ skyBoxEntity

Graphics::GraphicsEntityId Graphics::skyBoxEntity

◆ skyTurbidity

float Graphics::skyTurbidity

◆ [struct]

struct { ... } Graphics::state

◆ sunEntity

Graphics::GraphicsEntityId Graphics::sunEntity

◆ tableLayout

CoreGraphics::ResourcePipelineId Graphics::tableLayout

◆ texturePool

Util::FixedPool<uint32_t> Graphics::texturePool

◆ tickCboOffset

uint64_t Graphics::tickCboOffset[(uint) GlobalTables::NumQueues]

◆ tickParams

Shared::PerTickParams::STRUCT Graphics::tickParams

◆ tickParamsDirty

DirtySet Graphics::tickParamsDirty

◆ tickResourceTables

◆ viewAllocator

ViewAllocator Graphics::viewAllocator

◆ viewCboOffset

uint64_t Graphics::viewCboOffset[(uint) GlobalTables::NumQueues]

◆ viewConstants

Shared::ViewConstants::STRUCT Graphics::viewConstants

◆ viewConstantsDirty

DirtySet Graphics::viewConstantsDirty