test: fix unsafe changes

This commit is contained in:
chyyran 2023-02-16 17:38:00 -05:00
parent 63ec875cf4
commit 912099f00a
4 changed files with 56 additions and 44 deletions

View file

@ -291,7 +291,9 @@ pub mod d3d11_hello_triangle {
image: Option<Image>, image: Option<Image>,
) -> Result<Self> { ) -> Result<Self> {
let (dxgi_factory, device, context) = create_device()?; let (dxgi_factory, device, context) = create_device()?;
let filter = FilterChainD3D11::load_from_path(filter, &device, filter_options).unwrap(); let filter = unsafe {
FilterChainD3D11::load_from_path(filter, &device, filter_options).unwrap()
};
let lut = if let Some(image) = image { let lut = if let Some(image) = image {
let lut = ExampleTexture::new( let lut = ExampleTexture::new(
&device, &device,

View file

@ -288,7 +288,9 @@ pub mod d3d12_hello_triangle {
} }
} }
let filter = FilterChainD3D12::load_from_path(filter, &device, None).unwrap(); let filter = unsafe {
FilterChainD3D12::load_from_path(filter, &device, None).unwrap()
};
Ok(Sample { Ok(Sample {
dxgi_factory, dxgi_factory,

View file

@ -6,6 +6,8 @@ use librashader_runtime_gl::FilterChainGL;
#[test] #[test]
fn triangle_gl() { fn triangle_gl() {
let (glfw, window, events, shader, vao) = hello_triangle::gl3::setup(); let (glfw, window, events, shader, vao) = hello_triangle::gl3::setup();
unsafe {
let mut filter = FilterChainGL::load_from_path( let mut filter = FilterChainGL::load_from_path(
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", "../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
Some(&FilterChainOptionsGL { Some(&FilterChainOptionsGL {
@ -18,11 +20,13 @@ fn triangle_gl() {
// FilterChain::load_from_path("../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", None) // FilterChain::load_from_path("../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", None)
.unwrap(); .unwrap();
hello_triangle::gl3::do_loop(glfw, window, events, shader, vao, &mut filter); hello_triangle::gl3::do_loop(glfw, window, events, shader, vao, &mut filter);
}
} }
#[test] #[test]
fn triangle_gl46() { fn triangle_gl46() {
let (glfw, window, events, shader, vao) = hello_triangle::gl46::setup(); let (glfw, window, events, shader, vao) = hello_triangle::gl46::setup();
unsafe {
let mut filter = FilterChainGL::load_from_path( let mut filter = FilterChainGL::load_from_path(
// "../test/slang-shaders/vhs/VHSPro.slangp", // "../test/slang-shaders/vhs/VHSPro.slangp",
// "../test/slang-shaders/test/history.slangp", // "../test/slang-shaders/test/history.slangp",
@ -38,4 +42,5 @@ fn triangle_gl46() {
// FilterChain::load_from_path("../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", None) // FilterChain::load_from_path("../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", None)
.unwrap(); .unwrap();
hello_triangle::gl46::do_loop(glfw, window, events, shader, vao, &mut filter); hello_triangle::gl46::do_loop(glfw, window, events, shader, vao, &mut filter);
}
} }

View file

@ -8,6 +8,8 @@ use librashader_runtime_vk::FilterChainVulkan;
fn triangle_vk() { fn triangle_vk() {
let entry = unsafe { ash::Entry::load().unwrap() }; let entry = unsafe { ash::Entry::load().unwrap() };
let base = VulkanBase::new(entry).unwrap(); let base = VulkanBase::new(entry).unwrap();
unsafe {
let filter = FilterChainVulkan::load_from_path( let filter = FilterChainVulkan::load_from_path(
// "../test/slang-shaders/crt/crt-royale.slangp", // "../test/slang-shaders/crt/crt-royale.slangp",
"../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_GBA_SP/GBA_SP-[ADV]-[LCD-GRID]-[Night].slangp", "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_GBA_SP/GBA_SP-[ADV]-[LCD-GRID]-[Night].slangp",
@ -24,6 +26,7 @@ fn triangle_vk() {
.unwrap(); .unwrap();
hello_triangle::main(base, filter) hello_triangle::main(base, filter)
}
// let base = hello_triangle_old::ExampleBase::new(900, 600); // let base = hello_triangle_old::ExampleBase::new(900, 600);
// // let mut filter = FilterChainVulkan::load_from_path( // // let mut filter = FilterChainVulkan::load_from_path(