mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-10 06:31:48 +00:00
only update the RTAS when required
This commit is contained in:
parent
838c9a6485
commit
62f3a17e55
4 changed files with 12 additions and 4 deletions
|
@ -128,3 +128,8 @@ void DynamicLights::Draw()
|
|||
CmdDraw(3, 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool DynamicLights::WantRTASUpdate(const trRefdef_t& scene)
|
||||
{
|
||||
return scene.num_dlights > 0;
|
||||
}
|
||||
|
|
|
@ -323,6 +323,7 @@ struct DynamicLights
|
|||
{
|
||||
void Init();
|
||||
void Draw();
|
||||
bool WantRTASUpdate(const trRefdef_t& scene);
|
||||
|
||||
private:
|
||||
HPipeline pipeline;
|
||||
|
@ -333,7 +334,7 @@ struct Raytracing
|
|||
{
|
||||
void Init();
|
||||
void ProcessWorld(world_t& world);
|
||||
void BeginFrame();
|
||||
void BeginFrame(bool wantUpdate);
|
||||
HBuffer GetTLAS() { return tlasBuffer; }
|
||||
HBuffer GetInstanceBuffer() { return tlasInstanceBuffer; }
|
||||
|
||||
|
|
|
@ -560,7 +560,8 @@ void CRP::BeginFrame()
|
|||
imgui.BeginFrame();
|
||||
|
||||
// must be run outside of the RHI::BeginFrame/RHI::EndFrame pair
|
||||
raytracing.BeginFrame();
|
||||
const bool rtasUpdate = dynamicLights.WantRTASUpdate(tr.rtRefdef);
|
||||
raytracing.BeginFrame(rtasUpdate);
|
||||
|
||||
RHI::BeginFrame();
|
||||
ui.BeginFrame();
|
||||
|
|
|
@ -246,14 +246,15 @@ void Raytracing::ProcessWorld(world_t& world)
|
|||
}
|
||||
}
|
||||
|
||||
void Raytracing::BeginFrame()
|
||||
void Raytracing::BeginFrame(bool wantUpdate)
|
||||
{
|
||||
if(tr.world == NULL || tr.sceneCounterRT == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(crp_updateRTAS->integer == 0 && !IsNullHandle(tlasBuffer))
|
||||
if((crp_updateRTAS->integer == 0 || !wantUpdate) &&
|
||||
!IsNullHandle(tlasBuffer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue