Optimize various debug views performance

This commit is contained in:
Wojtek Figat
2022-12-03 12:23:39 +01:00
parent 950289db9f
commit df45ac46b1
10 changed files with 78 additions and 61 deletions

View File

@@ -10,6 +10,7 @@
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Renderer/DrawCall.h"
#include "Engine/Renderer/RenderList.h"
#include "Engine/Renderer/GBufferPass.h"
LODPreviewMaterialShader::LODPreviewMaterialShader()
{
@@ -47,26 +48,10 @@ void LODPreviewMaterialShader::Bind(BindParameters& params)
// Find the LOD that produced this draw call
int32 lodIndex = 0;
auto& drawCall = *params.FirstDrawCall;
for (auto& e : Content::GetAssetsRaw())
const ModelLOD* drawCallModelLod;
if (GBufferPass::IndexBufferToModelLOD.TryGet(drawCall.Geometry.IndexBuffer, drawCallModelLod))
{
auto model = ScriptingObject::Cast<Model>(e.Value);
if (!model)
continue;
bool found = false;
for (const auto& lod : model->LODs)
{
for (const auto& mesh : lod.Meshes)
{
if (mesh.GetIndexBuffer() == drawCall.Geometry.IndexBuffer)
{
lodIndex = mesh.GetLODIndex();
found = true;
break;
}
}
}
if (found)
break;
lodIndex = drawCallModelLod->GetLODIndex();
}
// Bind