changeset 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 2addc5f6804f
files semicongine/engine.nim
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/engine.nim	Tue Jun 25 20:24:38 2024 +0700
+++ b/semicongine/engine.nim	Tue Jun 25 21:20:15 2024 +0700
@@ -197,6 +197,12 @@
 func Limits*(engine: Engine): VkPhysicalDeviceLimits =
   engine.device.physicalDevice.properties.limits
 
+func MaxFramebufferSampleCount*(engine: Engine, maxSamples = VK_SAMPLE_COUNT_8_BIT): VkSampleCountFlagBits =
+  let available = VkSampleCountFlags(
+    engine.Limits.framebufferColorSampleCounts.uint32 and engine.Limits.framebufferDepthSampleCounts.uint32
+  ).toEnums
+  return min(max(available), maxSamples)
+
 proc UpdateInputs*(engine: Engine): bool =
   UpdateInputs(engine.window.PendingEvents())