shaders load

This commit is contained in:
Alex Janka 2023-10-02 17:33:49 +11:00
parent 78ed257291
commit e5a75ce06a
2 changed files with 27 additions and 26 deletions

View file

@ -19,6 +19,7 @@ const VERTICES: [Vertex; 3] = [Vertex(-1.0, -1.0), Vertex(3.0, -1.0), Vertex(-1.
pub struct WindowData { pub struct WindowData {
inner: VulkanWindowInner, inner: VulkanWindowInner,
filter_chain: FilterChain,
} }
pub struct WindowOptions { pub struct WindowOptions {
@ -29,31 +30,29 @@ impl WindowData {
pub fn new(factor: u32, window: &Window, options: WindowOptions) -> Self { pub fn new(factor: u32, window: &Window, options: WindowOptions) -> Self {
let inner = unsafe { VulkanWindowInner::new(factor, window) }; let inner = unsafe { VulkanWindowInner::new(factor, window) };
// let filter_chain_options = FilterChainOptions { let filter_chain_options = FilterChainOptions {
// frames_in_flight: 0, frames_in_flight: 0,
// force_no_mipmaps: false, force_no_mipmaps: false,
// use_render_pass: true, use_render_pass: true,
// disable_cache: false, disable_cache: false,
// }; };
// let physical_device = unsafe { let physical_devices = unsafe { inner.instance.enumerate_physical_devices().unwrap() };
// inner let physical_device = physical_devices.first().unwrap();
// .instance let vulkan = VulkanObjects::try_from((
// .enumerate_physical_devices() *physical_device,
// .unwrap() inner.instance.clone(),
// .first() inner.device.clone(),
// .unwrap() ))
// }; .unwrap();
// let vulkan = VulkanObjects::try_from(( let filter_chain = unsafe {
// *physical_device, FilterChain::load_from_path(options.shader_path, vulkan, Some(&filter_chain_options))
// inner.instance.clone(), }
// inner.device.clone(), .unwrap();
// ))
// .unwrap(); Self {
// let filter_chain = unsafe { inner,
// FilterChain::load_from_path(options.shader_path, vulkan, Some(&filter_chain_options)) filter_chain,
// } }
// .unwrap();
Self { inner }
} }
pub fn resize(&mut self, width: u32, height: u32, factor: u32, window: &Window) { pub fn resize(&mut self, width: u32, height: u32, factor: u32, window: &Window) {

View file

@ -117,7 +117,9 @@ impl WindowRenderer {
let real_factor = (window.scale_factor() * factor as f64) as usize; let real_factor = (window.scale_factor() * factor as f64) as usize;
let options = WindowOptions { let options = WindowOptions {
shader_path: std::path::PathBuf::new(), shader_path: std::path::PathBuf::from(
"./test-roms/shaders/slang-shaders/bilinear.slangp",
),
}; };
let data = Arc::new(Mutex::new(WindowData::new( let data = Arc::new(Mutex::new(WindowData::new(