summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-07-04 16:49:31 -0700
committerIrene Knapp <ireneista@irenes.space>2026-07-04 16:49:31 -0700
commitaea6d8b310dede44211fcf994f8ddb42df076d91 (patch)
treea0df2bf481b3fbccd66648634220fed411776fab /src/main.rs
parent8eb7bc2dcab860231c26bfe14d4c780449052da3 (diff)
load compiled SPIR-V bytecode (yay)
no way to build it except by hand, as-yet. the tutorial doesn't cover that, we'll need to circle back and write a build.rs

Force-Push: yes
Change-Id: I2b489381f95b4b7505862caa236dea1c60cd9c1a
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index f4e93cb..62c6025 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,6 +5,7 @@ use std::cell::OnceCell;
 use std::collections::{ BTreeMap, BTreeSet, HashSet };
 use std::ffi::{ c_void, CStr };
 use vulkanalia::{ Device, Entry, Instance, Version };
+use vulkanalia::bytecode::Bytecode;
 use vulkanalia::loader::{ LibloadingLoader, LIBRARY };
 use vulkanalia::vk::{ self, Handle, HasBuilder,
                       ApplicationInfo, InstanceCreateInfo,
@@ -180,6 +181,8 @@ impl Surreality {
       self.init_vulkan_swapchain()?;
     }
 
+    self.init_pipeline()?;
+
     Ok(())
   }
 
@@ -638,6 +641,25 @@ impl Surreality {
     Ok(())
   }
 
+  #[allow(unsafe_code)]
+  fn init_pipeline(&mut self) -> Result<()> {
+    // TODO integrate with Cargo
+    let vertex_binary = include_bytes!("../vert.spv");
+    let fragment_binary = include_bytes!("../frag.spv");
+
+    let _ = self.load_spirv_shader_module(vertex_binary)?;
+
+    Ok(())
+  }
+
+  fn load_spirv_shader_module(&mut self, binary: &[u8])
+      -> Result<vk::ShaderModule>
+  {
+    let bytecode = Bytecode::new(binary)?;
+
+    Err(Error { message: "just because".to_string() })
+  }
+
   //   To Vulkan, a "physical" device is the actual GPU, and a "logical"
   // device is per-process state that represents a connection to the GPU.
   // Before we can create a logical device, we must choose which physical