shaders load
This commit is contained in:
parent
78ed257291
commit
e5a75ce06a
2 changed files with 27 additions and 26 deletions
|
@ -19,6 +19,7 @@ const VERTICES: [Vertex; 3] = [Vertex(-1.0, -1.0), Vertex(3.0, -1.0), Vertex(-1.
|
|||
|
||||
pub struct WindowData {
|
||||
inner: VulkanWindowInner,
|
||||
filter_chain: FilterChain,
|
||||
}
|
||||
|
||||
pub struct WindowOptions {
|
||||
|
@ -29,31 +30,29 @@ impl WindowData {
|
|||
pub fn new(factor: u32, window: &Window, options: WindowOptions) -> Self {
|
||||
let inner = unsafe { VulkanWindowInner::new(factor, window) };
|
||||
|
||||
// let filter_chain_options = FilterChainOptions {
|
||||
// frames_in_flight: 0,
|
||||
// force_no_mipmaps: false,
|
||||
// use_render_pass: true,
|
||||
// disable_cache: false,
|
||||
// };
|
||||
// let physical_device = unsafe {
|
||||
// inner
|
||||
// .instance
|
||||
// .enumerate_physical_devices()
|
||||
// .unwrap()
|
||||
// .first()
|
||||
// .unwrap()
|
||||
// };
|
||||
// let vulkan = VulkanObjects::try_from((
|
||||
// *physical_device,
|
||||
// inner.instance.clone(),
|
||||
// inner.device.clone(),
|
||||
// ))
|
||||
// .unwrap();
|
||||
// let filter_chain = unsafe {
|
||||
// FilterChain::load_from_path(options.shader_path, vulkan, Some(&filter_chain_options))
|
||||
// }
|
||||
// .unwrap();
|
||||
Self { inner }
|
||||
let filter_chain_options = FilterChainOptions {
|
||||
frames_in_flight: 0,
|
||||
force_no_mipmaps: false,
|
||||
use_render_pass: true,
|
||||
disable_cache: false,
|
||||
};
|
||||
let physical_devices = unsafe { inner.instance.enumerate_physical_devices().unwrap() };
|
||||
let physical_device = physical_devices.first().unwrap();
|
||||
let vulkan = VulkanObjects::try_from((
|
||||
*physical_device,
|
||||
inner.instance.clone(),
|
||||
inner.device.clone(),
|
||||
))
|
||||
.unwrap();
|
||||
let filter_chain = unsafe {
|
||||
FilterChain::load_from_path(options.shader_path, vulkan, Some(&filter_chain_options))
|
||||
}
|
||||
.unwrap();
|
||||
|
||||
Self {
|
||||
inner,
|
||||
filter_chain,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn resize(&mut self, width: u32, height: u32, factor: u32, window: &Window) {
|
||||
|
|
|
@ -117,7 +117,9 @@ impl WindowRenderer {
|
|||
let real_factor = (window.scale_factor() * factor as f64) as usize;
|
||||
|
||||
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(
|
||||
|
|
Loading…
Add table
Reference in a new issue