rusticl/screen: Wrap get_timestamp
authorDr. David Alan Gilbert <dave@treblig.org>
Tue, 13 Jun 2023 00:48:34 +0000 (01:48 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 26 Jun 2023 10:00:47 +0000 (10:00 +0000)
Add a wrapper on our screen type to call get_timestamp.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23639>

src/gallium/frontends/rusticl/mesa/pipe/screen.rs

index 4b7d2d3..f6d381e 100644 (file)
@@ -305,6 +305,15 @@ impl PipeScreen {
         unsafe { s.is_format_supported.unwrap()(self.screen, format, target, 0, 0, bindings) }
     }
 
+    pub fn get_timestamp(&self) -> u64 {
+        // We have get_timestamp in has_required_cbs, so it will exist
+        unsafe {
+            (*self.screen)
+                .get_timestamp
+                .expect("get_timestamp should be required")(self.screen)
+        }
+    }
+
     pub fn nir_shader_compiler_options(
         &self,
         shader: pipe_shader_type,
@@ -376,6 +385,7 @@ fn has_required_cbs(screen: *mut pipe_screen) -> bool {
         & has_required_feature!(screen, get_name)
         & has_required_feature!(screen, get_param)
         & has_required_feature!(screen, get_shader_param)
+        & has_required_feature!(screen, get_timestamp)
         & has_required_feature!(screen, is_format_supported)
         & has_required_feature!(screen, resource_create)
 }