Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to avoid msvc optimization #17426

Merged
merged 1 commit into from
Jul 26, 2024
Merged
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
26 changes: 18 additions & 8 deletions native/cocos/renderer/pipeline/custom/NativePipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,24 +739,25 @@ void NativePipeline::updateRenderWindow(
if (resID == ResourceGraph::null_vertex()) {
return;
}
auto &desc = get(ResourceGraph::DescTag{}, resourceGraph, resID);
uint32_t width = 0;
uint32_t height = 0;
visitObject(
resID, resourceGraph,
[&](IntrusivePtr<gfx::Framebuffer> &fb) {
// deprecated
CC_EXPECTS(false);
CC_EXPECTS(!renderWindow->getSwapchain());
desc.width = renderWindow->getWidth();
desc.height = renderWindow->getHeight();
width = renderWindow->getWidth();
height = renderWindow->getHeight();
fb = renderWindow->getFramebuffer();
},
[&](RenderSwapchain &sc) {
auto *newSwapchain = renderWindow->getSwapchain();
const auto &oldTexture = resourceGraph.getTexture(resID);
resourceGraph.invalidatePersistentRenderPassAndFramebuffer(oldTexture);
if (newSwapchain) {
desc.width = newSwapchain->getWidth();
desc.height = newSwapchain->getHeight();
width = newSwapchain->getWidth();
height = newSwapchain->getHeight();

sc.renderWindow = nullptr;
sc.swapchain = renderWindow->getSwapchain();
Expand All @@ -767,8 +768,8 @@ void NativePipeline::updateRenderWindow(
CC_EXPECTS(renderWindow->getFramebuffer()->getColorTextures().front());

const auto &texture = renderWindow->getFramebuffer()->getColorTextures().front();
desc.width = texture->getWidth();
desc.height = texture->getHeight();
width = texture->getWidth();
height = texture->getHeight();

sc.renderWindow = renderWindow;
sc.swapchain = nullptr;
Expand All @@ -777,10 +778,19 @@ void NativePipeline::updateRenderWindow(
},
[](const auto & /*res*/) {});

CC_ENSURES(width);
CC_ENSURES(height);

{
auto &desc = get(ResourceGraph::DescTag{}, resourceGraph, resID);
desc.width = width;
desc.height = height;
}

// Associated depth stencil
tryAddRenderWindowDepthStencil(
*this, depthStencilName,
desc.width, desc.height,
width, height,
renderWindow->getSwapchain());
}

Expand Down
Loading