@@ -261,8 +261,8 @@ namespace cage
261261 " vulkan_use_dynamic_rendering" , //
262262 " wait_is_thread_safe" , // just to be sure
263263 };
264- if (!config.vsync )
265- toggles.push_back (" turn_off_vsync" );
264+ // if (!config.vsync)
265+ // toggles.push_back("turn_off_vsync");
266266#ifdef CAGE_DEPLOY
267267 toggles.push_back (" disable_robustness" );
268268 toggles.push_back (" skip_validation" );
@@ -361,16 +361,27 @@ namespace cage
361361 if (!context->surface .GetCapabilities (adapter, &capabilities))
362362 CAGE_THROW_ERROR (Exception, " failed to retrieve surface capabilities" );
363363
364- bool relaxed = false ;
364+ // bool relaxed = false;
365+ bool mailbox = false ;
366+ bool immediate = false ;
365367 for (uint32 i = 0 ; i < capabilities.presentModeCount ; i++)
366- if (capabilities.presentModes [i] == wgpu::PresentMode::FifoRelaxed)
367- relaxed = true ;
368+ {
369+ // if (capabilities.presentModes[i] == wgpu::PresentMode::FifoRelaxed)
370+ // relaxed = true;
371+ if (capabilities.presentModes [i] == wgpu::PresentMode::Mailbox)
372+ mailbox = true ;
373+ if (capabilities.presentModes [i] == wgpu::PresentMode::Immediate)
374+ immediate = true ;
375+ }
368376
369377 wgpu::SurfaceConfiguration cfg = {};
370378 cfg.device = device;
371379 cfg.width = resolution[0 ];
372380 cfg.height = resolution[1 ];
373- cfg.presentMode = relaxed ? wgpu::PresentMode::FifoRelaxed : wgpu::PresentMode::Fifo;
381+ if (config.vsync )
382+ cfg.presentMode = wgpu::PresentMode::Fifo;
383+ else
384+ cfg.presentMode = mailbox ? wgpu::PresentMode::Mailbox : immediate ? wgpu::PresentMode::Immediate : wgpu::PresentMode::Fifo;
374385 cfg.format = wgpu::TextureFormat::BGRA8Unorm; // this should be guaranteed to work everywhere
375386 cfg.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
376387 context->surface .Configure (&cfg);
0 commit comments