diff --git a/src/common/rendering/hwrenderer/data/hw_collision.cpp b/src/common/rendering/hwrenderer/data/hw_collision.cpp index 6faf5a473..a33f798c5 100644 --- a/src/common/rendering/hwrenderer/data/hw_collision.cpp +++ b/src/common/rendering/hwrenderer/data/hw_collision.cpp @@ -85,11 +85,14 @@ void CPUAccelStruct::FindFirstHit(const RayBBox& ray, int a, TraceHit* hit) } } +extern glcycle_t DynamicBLASTime; + void CPUAccelStruct::Update() { if (Mesh->UploadRanges.Index.Size() == 0) return; + DynamicBLASTime.ResetAndClock(); InstanceCount = (Mesh->Mesh.IndexCount + IndexesPerBLAS - 1) / IndexesPerBLAS; bool needsUpdate[32] = {}; @@ -112,6 +115,7 @@ void CPUAccelStruct::Update() DynamicBLAS[instance] = CreateBLAS(indexStart, indexEnd - indexStart); } } + DynamicBLASTime.Unclock(); CreateTLAS(); Upload(); diff --git a/src/gamedata/decallib.cpp b/src/gamedata/decallib.cpp index 6243502f8..ae9d96d76 100644 --- a/src/gamedata/decallib.cpp +++ b/src/gamedata/decallib.cpp @@ -986,6 +986,19 @@ void FDecalTemplate::ApplyToDecal (DBaseDecal *decal, side_t *wall) const { Animator->CreateThinker (decal, wall); } + + decal->Side = wall; + decal->WallPrev = wall->AttachedDecals; + + while (decal->WallPrev != nullptr && decal->WallPrev->WallNext != nullptr) + { + decal->WallPrev = decal->WallPrev->WallNext; + } + if (decal->WallPrev != nullptr) decal->WallPrev->WallNext = decal; + else wall->AttachedDecals = decal; + decal->WallNext = nullptr; + + LevelMeshUpdater->SideDecalsChanged(wall); } const FDecalTemplate *FDecalTemplate::GetDecal () const diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index e2878e3a5..758b16a5d 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -255,19 +255,8 @@ void DBaseDecal::SetShade (int r, int g, int b) FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *ffloor) { - Side = wall; - WallPrev = wall->AttachedDecals; - - while (WallPrev != nullptr && WallPrev->WallNext != nullptr) - { - WallPrev = WallPrev->WallNext; - } - if (WallPrev != nullptr) WallPrev->WallNext = this; - else wall->AttachedDecals = this; - WallNext = nullptr; - - LevelMeshUpdater->SideDecalsChanged(wall); - + Side = nullptr; + WallNext = WallPrev = nullptr; sector_t *front, *back; line_t *line; diff --git a/src/rendering/hwrenderer/doom_levelmesh.cpp b/src/rendering/hwrenderer/doom_levelmesh.cpp index 931c9485e..1efe47b34 100644 --- a/src/rendering/hwrenderer/doom_levelmesh.cpp +++ b/src/rendering/hwrenderer/doom_levelmesh.cpp @@ -55,6 +55,7 @@ static int InvalidateLightmap() } glcycle_t ProcessLevelMesh; +glcycle_t DynamicBLASTime; ADD_STAT(lightmap) { @@ -84,6 +85,7 @@ ADD_STAT(lightmap) "Surface pixel area to update: %u\n" "Surface pixel area: %u\nAtlas pixel area: %u\n" "Atlas efficiency: %.4f%%\n" + "Dynamic BLAS time: %2.3f ms\n" "Level mesh process time: %2.3f ms\n" "Level mesh index buffer: %d K used (%d%%)", stats.tiles.total, stats.tiles.dirty, @@ -91,6 +93,7 @@ ADD_STAT(lightmap) stats.pixels.total, atlasPixelCount, float(stats.pixels.total) / float(atlasPixelCount) * 100.0f, + DynamicBLASTime.TimeMS(), ProcessLevelMesh.TimeMS(), indexBufferUsed / 1000, indexBufferUsed * 100 / indexBufferTotal);