void Driver::decafSetBuffer(const latte::pm4::DecafSetBuffer &data) { SwapChainObject **swapChain; if (data.scanTarget == latte::pm4::ScanTarget::TV) { swapChain = &mTvSwapChain; } else if (data.scanTarget == latte::pm4::ScanTarget::DRC) { swapChain = &mDrcSwapChain; } else { decaf_abort("Unexpected decafSetBuffer target"); } // Release the existing swap chain if we had it... if (*swapChain) { releaseSwapChain(*swapChain); *swapChain = nullptr; } // Allocate a new swap chain auto swapChainDesc = SwapChainDesc { data.buffer, data.width, data.height }; auto newSwapChain = allocateSwapChain(swapChainDesc); // Give the swapchain a name so its easy to see. if (data.scanTarget == latte::pm4::ScanTarget::TV) { setVkObjectName(newSwapChain->image, fmt::format("swapchain_tv").c_str()); } else if (data.scanTarget == latte::pm4::ScanTarget::DRC) { setVkObjectName(newSwapChain->image, fmt::format("swapchain_drc").c_str()); } else { decaf_abort("Unexpected decafSetBuffer target"); } // Assign the new swap chain *swapChain = newSwapChain; // Only make this swapchain presentable after this frame has completed // (we need to run the frame at least once for setup to complete before use). addRetireTask([=](){ newSwapChain->presentable = true; }); }
SurfaceD3D::~SurfaceD3D() { unsubclassWindow(); releaseSwapChain(); }
SurfaceD3D::~SurfaceD3D() { releaseSwapChain(); SafeDelete(mNativeWindow); SafeRelease(mD3DTexture); }
SurfaceD3D::~SurfaceD3D() { releaseSwapChain(); }