| 34 | { |
| 35 | |
| 36 | Swapchain::Swapchain(ref<Device> pDevice, const Desc& desc, WindowHandle windowHandle) : mpDevice(pDevice), mDesc(desc) |
| 37 | { |
| 38 | FALCOR_ASSERT(mpDevice); |
| 39 | |
| 40 | FALCOR_CHECK(desc.format != ResourceFormat::Unknown, "Invalid format"); |
| 41 | FALCOR_CHECK(desc.width > 0, "Invalid width"); |
| 42 | FALCOR_CHECK(desc.height > 0, "Invalid height"); |
| 43 | FALCOR_CHECK(desc.imageCount > 0, "Invalid image count"); |
| 44 | |
| 45 | gfx::ISwapchain::Desc gfxDesc = {}; |
| 46 | gfxDesc.format = getGFXFormat(desc.format); |
| 47 | gfxDesc.width = desc.width; |
| 48 | gfxDesc.height = desc.height; |
| 49 | gfxDesc.imageCount = desc.imageCount; |
| 50 | gfxDesc.enableVSync = desc.enableVSync; |
| 51 | gfxDesc.queue = mpDevice->getGfxCommandQueue(); |
| 52 | #if FALCOR_WINDOWS |
| 53 | gfx::WindowHandle gfxWindowHandle = gfx::WindowHandle::FromHwnd(windowHandle); |
| 54 | #elif FALCOR_LINUX |
| 55 | gfx::WindowHandle gfxWindowHandle = gfx::WindowHandle::FromXWindow(windowHandle.pDisplay, windowHandle.window); |
| 56 | #endif |
| 57 | FALCOR_GFX_CALL(mpDevice->getGfxDevice()->createSwapchain(gfxDesc, gfxWindowHandle, mGfxSwapchain.writeRef())); |
| 58 | |
| 59 | prepareImages(); |
| 60 | } |
| 61 | |
| 62 | const ref<Texture>& Swapchain::getImage(uint32_t index) const |
| 63 | { |
nothing calls this directly
no test coverage detected