comparison semicongine/engine.nim @ 1168:73eaec7e1690

add: function to get max supported sampling count
author sam <sam@basx.dev>
date Tue, 25 Jun 2024 21:20:15 +0700
parents cdf7ec8d04d2
children
comparison
equal deleted inserted replaced
1167:cdf7ec8d04d2 1168:73eaec7e1690
195 engine.window.Fullscreen(engine.fullscreen) 195 engine.window.Fullscreen(engine.fullscreen)
196 196
197 func Limits*(engine: Engine): VkPhysicalDeviceLimits = 197 func Limits*(engine: Engine): VkPhysicalDeviceLimits =
198 engine.device.physicalDevice.properties.limits 198 engine.device.physicalDevice.properties.limits
199 199
200 func MaxFramebufferSampleCount*(engine: Engine, maxSamples = VK_SAMPLE_COUNT_8_BIT): VkSampleCountFlagBits =
201 let available = VkSampleCountFlags(
202 engine.Limits.framebufferColorSampleCounts.uint32 and engine.Limits.framebufferDepthSampleCounts.uint32
203 ).toEnums
204 return min(max(available), maxSamples)
205
200 proc UpdateInputs*(engine: Engine): bool = 206 proc UpdateInputs*(engine: Engine): bool =
201 UpdateInputs(engine.window.PendingEvents()) 207 UpdateInputs(engine.window.PendingEvents())
202 208
203 proc ProcessEvents*(engine: Engine, panel: var Panel) = 209 proc ProcessEvents*(engine: Engine, panel: var Panel) =
204 let hasMouseNow = panel.Contains(MousePositionNormalized(engine.window.Size), engine.GetAspectRatio) 210 let hasMouseNow = panel.Contains(MousePositionNormalized(engine.window.Size), engine.GetAspectRatio)