Tighten URP pass queue snapshot ownership

This commit is contained in:
2026-04-27 15:21:57 +08:00
parent c0b829cd6a
commit 66d968c3ce
22 changed files with 849 additions and 51 deletions

View File

@@ -1,10 +1,28 @@
#include <XCEngine/Rendering/Execution/CameraFramePlan.h>
#include <atomic>
namespace XCEngine {
namespace Rendering {
namespace {
uint64_t AllocateCameraFramePlanId() {
static std::atomic<uint64_t> s_nextFramePlanId{ 1u };
uint64_t framePlanId =
s_nextFramePlanId.fetch_add(
1u,
std::memory_order_relaxed);
if (framePlanId == 0u) {
framePlanId =
s_nextFramePlanId.fetch_add(
1u,
std::memory_order_relaxed);
}
return framePlanId;
}
CameraFrameFullscreenStagePlan* GetMutableFullscreenStagePlan(
CameraFramePlan& plan,
CameraFrameStage stage) {
@@ -59,6 +77,7 @@ RenderSurface CameraFramePlan::BuildCameraDepthOnlySurfaceTemplate(
CameraFramePlan CameraFramePlan::FromRequest(const CameraRenderRequest& request) {
CameraFramePlan plan = {};
plan.framePlanId = AllocateCameraFramePlanId();
plan.request = request;
plan.shadowCaster = request.shadowCaster;
plan.directionalShadow = request.directionalShadow;