Skip to content

Commit

Permalink
Fixed issues regarding thread safety
Browse files Browse the repository at this point in the history
  • Loading branch information
tippesi committed Jan 5, 2025
1 parent 76d9ca6 commit 201850d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/editor/ui/panels/VegetationGeneratorPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ namespace Atlas::Editor::UI {
}

void VegetationGeneratorPanel::RenderBiomeVegetationTypes(Ref<Terrain::Terrain>& terrain, TerrainGenerator& terrainGenerator) {

if (Singletons::blockingOperation->block)
return;

const ImGuiTreeNodeFlags nodeFlags = ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_FramePadding
| ImGuiTreeNodeFlags_AllowOverlap;
Expand Down Expand Up @@ -165,4 +168,4 @@ namespace Atlas::Editor::UI {

}

}
}
2 changes: 2 additions & 0 deletions src/engine/renderer/MainRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ namespace Atlas {
commandList->BindBuffer(cloudShadowUniformBuffer, 1, 19);

ddgiRenderer.TraceAndUpdateProbes(target, scene, commandList);

JobSystem::WaitSpin(scene->renderState.fillMainRenderPassJob);

{
Graphics::Profiler::BeginQuery("Main render pass");
Expand Down
8 changes: 5 additions & 3 deletions src/engine/scene/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,12 @@ namespace Atlas {

lightComponent.Update(transformComponent);

auto& mainCamera = GetMainCamera();
lightComponent.Update(mainCamera);
if (mainCameraEntity.IsValid()) {
auto& mainCamera = GetMainCamera();
lightComponent.Update(mainCamera);

renderState.FillShadowRenderPass(Entity(entity, &entityManager));
renderState.FillShadowRenderPass(Entity(entity, &entityManager));
}
});

JobSystem::Wait(lightJobGroup);
Expand Down
4 changes: 2 additions & 2 deletions src/engine/terrain/TerrainManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Atlas::Terrain {

bool TerrainManager::enable = true;
std::atomic_bool TerrainManager::enable = true;
JobGroup TerrainManager::loadTerrainCellGroup;

void TerrainManager::Update() {
Expand Down Expand Up @@ -47,4 +47,4 @@ namespace Atlas::Terrain {

}

}
}
4 changes: 2 additions & 2 deletions src/engine/terrain/TerrainManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace Atlas::Terrain {

static void WaitForJobCompletion();

static bool enable;
static std::atomic_bool enable;

private:
static JobGroup loadTerrainCellGroup;

};

}
}

0 comments on commit 201850d

Please sign in to comment.