From 322f2add2ccea7191ec9cdd4f413e55d0c8c5b40 Mon Sep 17 00:00:00 2001 From: John Goetz Date: Mon, 18 Nov 2024 09:58:40 -0800 Subject: [PATCH] Use renderArea instead of full window when compiling RenderGraph Use renderArea of RenderGraph instead of the full window/framebuffer extent when creating the compile-context default viewportstate Nominally, Views are above RenderGraphs in VSG scene graphs, however when a View that takes up a subset of the window/framebuffer extent contains individual RenderGraphs, the recorded default renderArea (viewportstate) was incorrect and resulted in the scene being drawn to the entire window area, but scissored to the render graphs renderArea. This change ensures that the default viewportstate is consistent with the rendergraph being compiled. --- src/vsg/app/CompileTraversal.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/vsg/app/CompileTraversal.cpp b/src/vsg/app/CompileTraversal.cpp index 028e9554d..38cc0e70a 100644 --- a/src/vsg/app/CompileTraversal.cpp +++ b/src/vsg/app/CompileTraversal.cpp @@ -387,14 +387,9 @@ void CompileTraversal::apply(RenderGraph& renderGraph) auto previousOverridePipelineStates = context->overridePipelineStates; context->renderPass = renderGraph.getRenderPass(); - if (renderGraph.window) - { - mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, ViewportState::create(renderGraph.window->extent2D())); - } - else if (renderGraph.framebuffer) - { - mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, ViewportState::create(renderGraph.framebuffer->extent2D())); - } + auto const& ra = renderGraph.renderArea; + mergeGraphicsPipelineStates(context->mask, context->defaultPipelineStates, + ViewportState::create(ra.offset.x, ra.offset.y, ra.extent.width, ra.extent.height)); if (context->renderPass) {