Add render graph depth access semantics
This commit is contained in:
@@ -279,6 +279,17 @@ RenderGraphTextureDesc BuildTestTextureDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
RenderGraphTextureDesc BuildTestDepthTextureDesc() {
|
||||
RenderGraphTextureDesc desc = {};
|
||||
desc.width = 1024u;
|
||||
desc.height = 1024u;
|
||||
desc.format = static_cast<XCEngine::Core::uint32>(Format::D24_UNorm_S8_UInt);
|
||||
desc.textureType = static_cast<XCEngine::Core::uint32>(TextureType::Texture2D);
|
||||
desc.sampleCount = 1u;
|
||||
desc.sampleQuality = 0u;
|
||||
return desc;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(RenderGraph_Test, CompilesDeclaredPassOrderAndTracksTextureLifetimes) {
|
||||
@@ -533,6 +544,36 @@ TEST(RenderGraph_Test, RejectsGraphOwnedImportedTextureWithoutView) {
|
||||
EXPECT_FALSE(errorMessage.Empty());
|
||||
}
|
||||
|
||||
TEST(RenderGraph_Test, TracksDepthAttachmentTransitionPlan) {
|
||||
RenderGraph graph;
|
||||
RenderGraphBuilder builder(graph);
|
||||
|
||||
const RenderGraphTextureDesc depthDesc = BuildTestDepthTextureDesc();
|
||||
const RenderGraphTextureHandle depthTexture =
|
||||
builder.CreateTransientTexture("SceneDepth", depthDesc);
|
||||
|
||||
builder.AddRasterPass(
|
||||
"DepthPrepass",
|
||||
[&](RenderGraphPassBuilder& pass) {
|
||||
pass.WriteDepthTexture(depthTexture);
|
||||
});
|
||||
|
||||
CompiledRenderGraph compiledGraph;
|
||||
XCEngine::Containers::String errorMessage;
|
||||
ASSERT_TRUE(RenderGraphCompiler::Compile(graph, compiledGraph, &errorMessage))
|
||||
<< errorMessage.CStr();
|
||||
|
||||
RenderGraphTextureTransitionPlan transitionPlan = {};
|
||||
ASSERT_TRUE(compiledGraph.TryGetTextureTransitionPlan(depthTexture, transitionPlan));
|
||||
EXPECT_TRUE(transitionPlan.graphOwnsTransitions);
|
||||
EXPECT_TRUE(transitionPlan.hasFirstAccessState);
|
||||
EXPECT_TRUE(transitionPlan.hasLastAccessState);
|
||||
EXPECT_EQ(transitionPlan.initialState, ResourceStates::Common);
|
||||
EXPECT_EQ(transitionPlan.firstAccessState, ResourceStates::DepthWrite);
|
||||
EXPECT_EQ(transitionPlan.lastAccessState, ResourceStates::DepthWrite);
|
||||
EXPECT_EQ(transitionPlan.finalState, ResourceStates::DepthWrite);
|
||||
}
|
||||
|
||||
TEST(RenderGraph_Test, ExecutesCompiledPassCallbacksInCompiledOrder) {
|
||||
RenderGraph graph;
|
||||
RenderGraphBuilder builder(graph);
|
||||
|
||||
Reference in New Issue
Block a user