]> git.nega.tv - josh/narcissus/commitdiff
narcissus-gpu: Add extra feature checks
authorJoshua Simmons <josh@nega.tv>
Thu, 9 Oct 2025 18:04:31 +0000 (20:04 +0200)
committerJoshua Simmons <josh@nega.tv>
Thu, 9 Oct 2025 18:04:39 +0000 (20:04 +0200)
engine/narcissus-gpu/src/backend/vulkan/mod.rs
engine/narcissus-gpu/src/backend/vulkan/physical_device_features.rs

index 9180c01acbc9fbfcfb8508badaaeb554d30befa7..6573e627e82ee712f83d5e281feebab4569ef0a0 100644 (file)
@@ -536,6 +536,10 @@ impl VulkanDevice {
                     && physical_device_features.descriptor_binding_partially_bound()
                     && physical_device_features.draw_indirect_count()
                     && physical_device_features.uniform_buffer_standard_layout()
+                    && physical_device_features.memory_model()
+                    && physical_device_features.memory_model_device_scope()
+                    && physical_device_features.shader_draw_parameters()
+                    && physical_device_features.scalar_block_layout()
             })
             .expect("no supported physical devices reported");
 
@@ -605,6 +609,10 @@ impl VulkanDevice {
             enabled_features.set_synchronization2(true);
             enabled_features.set_timeline_semaphore(true);
             enabled_features.set_uniform_buffer_standard_layout(true);
+            enabled_features.set_memory_model(true);
+            enabled_features.set_memory_model_device_scope(true);
+            enabled_features.set_shader_draw_parameters(true);
+            enabled_features.set_scalar_block_layout(true);
 
             if wsi_support.swapchain_maintenance1() {
                 enabled_features.set_swapchain_maintenance1(true);
index 0fb71b79c71eef449931ad7cf2785c64935c6585..e8d5d5b992d43d3c5ba4edf12f96774812228fb9 100644 (file)
@@ -46,6 +46,22 @@ impl VulkanPhysicalDeviceFeatures {
         self.features_12.uniform_buffer_standard_layout == vk::Bool32::True
     }
 
+    pub fn memory_model(&self) -> bool {
+        self.features_12.vulkan_memory_model == vk::Bool32::True
+    }
+
+    pub fn memory_model_device_scope(&self) -> bool {
+        self.features_12.vulkan_memory_model_device_scope == vk::Bool32::True
+    }
+
+    pub fn shader_draw_parameters(&self) -> bool {
+        self.features_11.shader_draw_parameters == vk::Bool32::True
+    }
+
+    pub fn scalar_block_layout(&self) -> bool {
+        self.features_12.scalar_block_layout == vk::Bool32::True
+    }
+
     pub fn set_buffer_device_address(&mut self, arg: bool) {
         self.features_12.buffer_device_address = vk::Bool32::from(arg)
     }
@@ -106,6 +122,22 @@ impl VulkanPhysicalDeviceFeatures {
         self.features_12.uniform_buffer_standard_layout = vk::Bool32::from(arg)
     }
 
+    pub fn set_memory_model(&mut self, arg: bool) {
+        self.features_12.vulkan_memory_model = vk::Bool32::from(arg)
+    }
+
+    pub fn set_memory_model_device_scope(&mut self, arg: bool) {
+        self.features_12.vulkan_memory_model_device_scope = vk::Bool32::from(arg)
+    }
+
+    pub fn set_shader_draw_parameters(&mut self, arg: bool) {
+        self.features_11.shader_draw_parameters = vk::Bool32::from(arg)
+    }
+
+    pub fn set_scalar_block_layout(&mut self, arg: bool) {
+        self.features_12.scalar_block_layout = vk::Bool32::from(arg)
+    }
+
     pub fn link(&mut self) -> &mut vk::PhysicalDeviceFeatures2 {
         self.features_13._next = &mut self.features_swapchain_maintenance1 as *mut _ as *mut _;
         self.features_12._next = &mut self.features_13 as *mut _ as *mut _;