ATOM-15935 Adding draw to pass support to DynamicDrawContext (#2248)

The DynamicDrawContext can output to different scopes: Scene, RenderPipeline or RasterPass.
Updated RasterPass so it can handle not only draw calls from Views but also from DynamicDrawContexts.
This commit is contained in:
Qing Tao
2021-07-19 10:03:59 -07:00
committed by GitHub
parent b01cd0c788
commit 9053079a56
10 changed files with 261 additions and 101 deletions
+2 -1
View File
@@ -96,7 +96,7 @@ void CDraw2d::OnBootstrapSceneReady([[maybe_unused]] AZ::RPI::Scene* bootstrapSc
AZ_Assert(scene != nullptr, "Attempting to create a DynamicDrawContext for a viewport context that has not been associated with a scene yet.");
// Create and initialize a DynamicDrawContext for 2d drawing
m_dynamicDraw = AZ::RPI::DynamicDrawInterface::Get()->CreateDynamicDrawContext(scene.get());
m_dynamicDraw = AZ::RPI::DynamicDrawInterface::Get()->CreateDynamicDrawContext();
AZ::RPI::ShaderOptionList shaderOptions;
shaderOptions.push_back(AZ::RPI::ShaderOption(AZ::Name("o_useColorChannels"), AZ::Name("true")));
shaderOptions.push_back(AZ::RPI::ShaderOption(AZ::Name("o_clamp"), AZ::Name("false")));
@@ -107,6 +107,7 @@ void CDraw2d::OnBootstrapSceneReady([[maybe_unused]] AZ::RPI::Scene* bootstrapSc
{"TEXCOORD0", AZ::RHI::Format::R32G32_FLOAT} });
m_dynamicDraw->AddDrawStateOptions(AZ::RPI::DynamicDrawContext::DrawStateOptions::PrimitiveType
| AZ::RPI::DynamicDrawContext::DrawStateOptions::BlendMode);
m_dynamicDraw->SetOutputScope(scene.get());
m_dynamicDraw->EndInit();
AZ::RHI::TargetBlendState targetBlendState;