MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / Swapchain

Method Swapchain

Source/Falcor/Core/API/Swapchain.cpp:36–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34{
35
36Swapchain::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
62const ref<Texture>& Swapchain::getImage(uint32_t index) const
63{

Callers

nothing calls this directly

Calls 2

getGFXFormatFunction · 0.85
writeRefMethod · 0.80

Tested by

no test coverage detected