Add RenderBuffers::LinkedCustomBuffers to reuse main game viewport rendered state (eg. GI) in sub-rendered view
This commit is contained in:
@@ -128,6 +128,8 @@ void RenderBuffers::SetUseAlpha(bool value)
|
||||
|
||||
const RenderBuffers::CustomBuffer* RenderBuffers::FindCustomBuffer(const StringView& name) const
|
||||
{
|
||||
if (LinkedCustomBuffers)
|
||||
return LinkedCustomBuffers->FindCustomBuffer(name);
|
||||
for (const CustomBuffer* e : CustomBuffers)
|
||||
{
|
||||
if (e->Name == name)
|
||||
@@ -196,6 +198,7 @@ bool RenderBuffers::Init(int32 width, int32 height)
|
||||
void RenderBuffers::Release()
|
||||
{
|
||||
LastEyeAdaptationTime = 0;
|
||||
LinkedCustomBuffers = nullptr;
|
||||
|
||||
for (int32 i = 0; i < _resources.Count(); i++)
|
||||
_resources[i]->ReleaseGPU();
|
||||
|
||||
@@ -178,6 +178,8 @@ public:
|
||||
template<class T>
|
||||
T* GetCustomBuffer(const StringView& name)
|
||||
{
|
||||
if (LinkedCustomBuffers)
|
||||
return LinkedCustomBuffers->GetCustomBuffer<T>(name);
|
||||
CustomBuffer* result = (CustomBuffer*)FindCustomBuffer(name);
|
||||
if (!result)
|
||||
{
|
||||
@@ -206,6 +208,11 @@ public:
|
||||
/// </remarks>
|
||||
API_FIELD(ReadOnly) GPUTexture* MotionVectors;
|
||||
|
||||
/// <summary>
|
||||
/// External Render Buffers used to redirect FindCustomBuffer/GetCustomBuffer calls. Can be linked to other rendering task (eg. main game viewport) to reuse graphics effect state from it (eg. use GI from main game view in in-game camera renderer).
|
||||
/// </summary>
|
||||
API_FIELD() RenderBuffers* LinkedCustomBuffers = nullptr;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Allocates the buffers.
|
||||
|
||||
Reference in New Issue
Block a user