Remove explicit feature-pass shadow graph handle

This commit is contained in:
2026-04-14 21:40:02 +08:00
parent 5b0a1743d9
commit 86eb455ab9
4 changed files with 22 additions and 7 deletions

View File

@@ -474,6 +474,14 @@ public:
const SceneRenderFeaturePassRenderGraphContext& context) override {
++recordGraphCallCount;
lastReceivedSourceColorTextureValid = context.sourceColorTexture.IsValid();
lastReceivedRenderGraphBlackboard = context.blackboard != nullptr;
if (const CameraFrameRenderGraphResources* frameResources =
TryGetCameraFrameRenderGraphResources(context.blackboard)) {
lastReceivedMainDirectionalShadowValid =
frameResources->mainDirectionalShadow.IsValid();
} else {
lastReceivedMainDirectionalShadowValid = false;
}
RecordEvent("RecordGraph");
return SceneRenderFeaturePass::RecordRenderGraph(context);
}
@@ -492,6 +500,8 @@ public:
bool lastSourceSurfaceAutoTransitionEnabled = true;
XCEngine::RHI::RHIResourceView* lastSourceColorView = nullptr;
bool lastReceivedSourceColorTextureValid = false;
bool lastReceivedRenderGraphBlackboard = false;
bool lastReceivedMainDirectionalShadowValid = false;
private:
void RecordEvent(const char* suffix) {
@@ -749,7 +759,6 @@ TEST(SceneRenderFeaturePass_Test, RecordsDefaultGraphPassAndExecutesWrappedCallb
{},
{ colorTarget },
depthTarget,
{},
false,
&executionSucceeded,
[&beginPassCalls](const RenderPassContext&, bool) {
@@ -849,7 +858,6 @@ TEST(SceneRenderFeaturePass_Test, ReadsSourceColorTextureAndCopiesSourceSurfaceT
sourceColor,
{ outputColor },
{},
{},
false,
&executionSucceeded,
{},
@@ -1031,6 +1039,8 @@ TEST(SceneRenderFeatureHost_Test, RecordsActiveInjectionPointFeaturesIntoRenderG
graphBuilder.ImportTexture("Color", colorDesc, &colorView, graphManagedImport);
const RenderGraphTextureHandle depthTarget =
graphBuilder.ImportTexture("Depth", depthDesc, &depthView, graphManagedImport);
const RenderGraphTextureHandle shadowTarget =
graphBuilder.ImportTexture("Shadow", depthDesc, &depthView, graphManagedImport);
RenderContext renderContext = {};
RenderSceneData sceneData = {};
@@ -1038,6 +1048,10 @@ TEST(SceneRenderFeatureHost_Test, RecordsActiveInjectionPointFeaturesIntoRenderG
surface.SetColorAttachment(&colorView);
surface.SetDepthAttachment(&depthView);
surface.SetAutoTransitionEnabled(false);
RenderGraphBlackboard blackboard = {};
CameraFrameRenderGraphResources& frameResources =
blackboard.Emplace<CameraFrameRenderGraphResources>();
frameResources.mainDirectionalShadow = shadowTarget;
bool executionSucceeded = true;
const SceneRenderFeaturePassRenderGraphContext context = {
@@ -1052,14 +1066,14 @@ TEST(SceneRenderFeatureHost_Test, RecordsActiveInjectionPointFeaturesIntoRenderG
{},
{ colorTarget },
depthTarget,
{},
true,
&executionSucceeded,
[](const RenderPassContext&, bool) {
return true;
},
[](const RenderPassContext&) {
}
},
&blackboard
};
bool recordedAnyPass = false;
@@ -1081,6 +1095,10 @@ TEST(SceneRenderFeatureHost_Test, RecordsActiveInjectionPointFeaturesIntoRenderG
EXPECT_EQ(secondRaw->recordGraphCallCount, 1u);
EXPECT_EQ(otherPointRaw->recordGraphCallCount, 0u);
EXPECT_EQ(inactiveRaw->recordGraphCallCount, 0u);
EXPECT_TRUE(firstRaw->lastReceivedRenderGraphBlackboard);
EXPECT_TRUE(secondRaw->lastReceivedRenderGraphBlackboard);
EXPECT_TRUE(firstRaw->lastReceivedMainDirectionalShadowValid);
EXPECT_TRUE(secondRaw->lastReceivedMainDirectionalShadowValid);
}
TEST(BuiltinForwardPipeline_Test, RegistersAdditionalForwardSceneFeaturePasses) {