Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/vsg/app/CompileTraversal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,13 @@ void CompileTraversal::apply(RenderGraph& renderGraph)
auto previousOverridePipelineStates = context->overridePipelineStates;

context->renderPass = renderGraph.getRenderPass();
if (renderGraph.window)
auto const& ra = renderGraph.renderArea;
auto viewportState = ViewportState::create(ra.offset.x, ra.offset.y, ra.extent.width, ra.extent.height);
if (auto view{context->view.ref_ptr()}; view && view->camera)
{
mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, ViewportState::create(renderGraph.window->extent2D()));
}
else if (renderGraph.framebuffer)
{
mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, ViewportState::create(renderGraph.framebuffer->extent2D()));
viewportState->viewports[0] = view->camera->viewportState->viewports[0];
}
mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, viewportState);

if (context->renderPass)
{
Expand All @@ -421,11 +420,13 @@ void CompileTraversal::apply(View& view)
if (context_view && context_view.get() != &view) continue;

// save previous states
auto previous_view = context->view;
auto previous_viewID = context->viewID;
auto previous_mask = context->mask;
auto previous_overridePipelineStates = context->overridePipelineStates;
auto previous_defaultPipelineStates = context->defaultPipelineStates;

context->view = &view;
context->viewID = view.viewID;
context->mask = view.mask;
context->viewDependentState = view.viewDependentState.get();
Expand All @@ -442,6 +443,7 @@ void CompileTraversal::apply(View& view)
view.traverse(*this);

// restore previous states
context->view = previous_view;
context->viewID = previous_viewID;
context->mask = previous_mask;
context->defaultPipelineStates = previous_defaultPipelineStates;
Expand Down
Loading