summary refs log tree commit diff
path: root/src/graphics/permanent.rs
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-08-09 17:36:41 -0700
committerIrene Knapp <ireneista@irenes.space>2026-08-09 17:53:43 -0700
commitd672e147db0df6186c528262367770dcde9d75fc (patch)
tree58d590891fffec7d5db47e8adf9beb677a5a1356 /src/graphics/permanent.rs
parent4158fed109ae789cb3ca7ff53c2790797a3b4087 (diff)
rename and reexport a bunch of graphics state types
the word "graphics" is part of the module name, so it does not need to be part of the struct name

the fact that an object holds state is... not strictly implied by the fact it's a struct, but it happens that ALL our objects exist primarily to hold state, so we remove that word as well

Force-Push: yes
Change-Id: I1b3e2ac0f1c29304e75a190172463aabfba4b3a4
Diffstat (limited to 'src/graphics/permanent.rs')
-rw-r--r--src/graphics/permanent.rs33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/graphics/permanent.rs b/src/graphics/permanent.rs
index f359dbd..df86284 100644
--- a/src/graphics/permanent.rs
+++ b/src/graphics/permanent.rs
@@ -19,10 +19,10 @@ use winit::window::{ Window, WindowAttributes };
 const VULKAN_FIRST_PORTABILITY_VERSION: Version = Version::new(1, 3, 216);
 
 
-//   The PermanentGraphicsState collects the various windowing-system and
-// Vulkan objects which never need to be regenerated once they're created. The
-// ones which do need that are collected below, in WindowDressing.
-pub struct PermanentGraphicsState {
+//   Permanent is a state object which collects the various windowing-system
+// and Vulkan objects which never need to be regenerated once they're created.
+// The ones which do need that are collected below, in WindowDressing.
+pub struct Permanent {
   //   The "window" is the usual operating-system concept of a window; it's
   // provided by winit, and may be X11, Wayland, or some more curious thing.
   // The way we initialize Vulkan requires us to have at least one of these;
@@ -100,11 +100,10 @@ pub struct EnableAnisotropy(pub bool);
 pub struct EnableSwapchain(pub bool);
 
 
-impl PermanentGraphicsState {
+impl Permanent {
   #[allow(unsafe_code)]
   pub fn new(event_loop: &ActiveEventLoop)
-      -> Result<(Self, GraphicsStateForReinit, EnableAnisotropy,
-                 EnableSwapchain)>
+      -> Result<(Self, ForReinit, EnableAnisotropy, EnableSwapchain)>
   {
     let window = init_window(event_loop)?;
 
@@ -141,11 +140,11 @@ impl PermanentGraphicsState {
     let (primary_command_pool, transient_command_pool)
             = init_command_pools(&device, &indices)?;
 
-    Ok((PermanentGraphicsState {
+    Ok((Permanent {
       window, entry, instance, debug_messager, surface, device,
       graphics_queue, presentation_queue,
       primary_command_pool, transient_command_pool,
-    }, GraphicsStateForReinit {
+    }, ForReinit {
       indices, sample_count, descriptor_set_layout,
     }, enable_anisotropy, enable_swapchain))
   }
@@ -230,18 +229,18 @@ impl PermanentGraphicsState {
 }
 
 
-//   The GraphicsStateForReinit connects Vulkan objects which are only needed
-// during the creation of the window-dressing objects. They are used during
-// initial startup, and again any time the window-dressing needs to be
-// reinitialized. Most notably, they are not needed when rendering.
-pub struct GraphicsStateForReinit {
+//   ForReinit is a state object that collects Vulkan objects which are only
+// needed during the creation of the window-dressing objects. They are used
+// during initial startup, and again any time the window-dressing needs to be
+// reinitialized.  Most notably, they are not needed when rendering.
+pub struct ForReinit {
   pub indices: QueueFamilyIndices,
   pub sample_count: vk::SampleCountFlags,
   pub descriptor_set_layout: vk::DescriptorSetLayout,
 }
 
 
-impl GraphicsStateForReinit {
+impl ForReinit {
   #[allow(unsafe_code)]
   pub fn destroy(self, device: &Device) -> () {
     unsafe {
@@ -494,7 +493,7 @@ fn init_vulkan_device(instance: &Instance, surface: &vk::SurfaceKHR,
     // we are discarding its results a second time. We'll do it for the
     // third and last time in swapchain creation.
     if let Acceptable::Accepted(_)
-           = PermanentGraphicsState::find_device_swapchain_features(
+           = Permanent::find_device_swapchain_features(
                  &instance, &surface, &physical_device)?
     {
       extensions.push(swapchain_extension_name.as_ptr());
@@ -752,7 +751,7 @@ fn score_vulkan_device(instance: &Instance, surface: &vk::SurfaceKHR,
     //   With that said, however, it only counts if we're able to actually
     // use it on the surface we have. Let's find out...
     if let Acceptable::Accepted(_)
-           = PermanentGraphicsState::find_device_swapchain_features(
+           = Permanent::find_device_swapchain_features(
                  instance, surface, physical_device)?
     {
       //   We don't count it for enough points to override a device type