vault backup: 2025-06-25 23:40:45

This commit is contained in:
BlueRose 2025-06-25 23:40:46 +08:00
parent a92bd7ebd9
commit 40109f2e4a
2 changed files with 61 additions and 3 deletions
03-UnrealEngine/Rendering/RenderFeature

@ -20,13 +20,14 @@ rating: ⭐
---
### 关键方法
- **`BeginFence()`**
在渲染命令队列中插入一个“栅栏标记”,表示同步点。调用后游戏线程可以继续执行其他任务。
- **`BeginFence(bool bSyncToRHIAndGPU = false)`**
- 在渲染命令队列中插入一个“栅栏标记”,表示同步点。调用后游戏线程可以继续执行其他任务。
- `bSyncToRHIAndGPU` - 是否等待 RHI 线程或 GPU否则只等待渲染线程。
- **`Wait(bool bProcessGameThreadTasks = false)`**
- 阻塞游戏线程,直到渲染线程处理到栅栏位置(即执行完栅栏之前的所有渲染命令)。
- `bProcessGameThreadTasks`: 若为 `true`,等待期间允许游戏线程处理其他任务(如消息泵)。
- **`IsFenceComplete()`**
非阻塞检查栅栏是否已完成(渲染线程是否已越过栅栏点)。
- 非阻塞检查栅栏是否已完成(渲染线程是否已越过栅栏点)。
---

@ -154,6 +154,63 @@ void AShaderWorldActor::ReadbacksManagement()
```
### CollisionManagement()
```c++
void AShaderWorldActor::CollisionManagement(float& DeltaT)
{
SCOPED_NAMED_EVENT_TEXT("AShaderWorldActor::CollisionManagement", FColor::Magenta);
SW_FCT_CYCLE()
/*
* Can we execute compute shader?
* Do we need to rebuild collision?
* Did ShaderWorld toggled collision generation On/Off?
* Are we pending a full rebuild of the Shader World?
*/
if (!SetupCollisions())
return;
/*
* Using collision updates, update Collision meshes
*/
if (!CollisionFinalizeWork())
return;
if (CollisionProcess.IsFenceComplete())
{
/*
* Convert Compute shader results to actionable collision updates
*/
if (!CollisionPreprocessGPU())
{
CollisionProcess.BeginFence(true);
return;
}
}
/*
* Process GPU work queue by launching GPU tasks to evaluate the collision of new tiles
*/
CollisionGPU();
// Timer
{
CollisionUpdateTimeAcu += DeltaT;
if (CollisionUpdateTimeAcu <= 1.f / 10.f || CollisionWorkQueue.Num() > 0 || !CollisionProcess.IsFenceComplete())
return;
CollisionUpdateTimeAcu = 0.f;
}
/*
* Gather relevant collision tiles
* If an old tile is not relevant anymore, release it.
* If a new location needs to be computed: allocate a tile and add its relevant computation work to the GPU work queue
*/
CollisionCPU();
}
```
#### SetupCollisions()
### SpawnablesManagement()