Skip to content

Commit

Permalink
refine setFramebuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
2youyou2 committed May 10, 2024
1 parent c852c58 commit 9cbd1fd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion native/cocos/scene/RenderWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ bool RenderWindow::initialize(gfx::Device *device, IRenderWindowInfo &info) {

void RenderWindow::setFrameBuffer(gfx::Framebuffer *fb) {
_frameBuffer = fb;
for (auto *tex : fb->getColorTextures()) {
if (fb != nullptr) {
for (auto *tex : fb->getColorTextures()) {
if (tex == nullptr) continue;

_width = tex->getWidth();
Expand All @@ -118,6 +119,13 @@ void RenderWindow::setFrameBuffer(gfx::Framebuffer *fb) {
_colorTextures.pushBack(tex);
}
_depthStencilTexture = fb->getDepthStencilTexture();
}
else {
_depthStencilTexture = nullptr;
_colorTextures.clear();
_width = 0;
_height = 0;
}
}

void RenderWindow::destroy() {
Expand Down

0 comments on commit 9cbd1fd

Please sign in to comment.