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,36 +6,41 @@ 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();
let mut filter = FilterChainGL::load_from_path(
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", unsafe {
Some(&FilterChainOptionsGL { let mut filter = FilterChainGL::load_from_path(
glsl_version: 0, "../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
use_dsa: false, Some(&FilterChainOptionsGL {
force_no_mipmaps: false, glsl_version: 0,
disable_cache: false, use_dsa: false,
}), force_no_mipmaps: false,
) disable_cache: false,
// FilterChain::load_from_path("../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", None) }),
.unwrap(); )
hello_triangle::gl3::do_loop(glfw, window, events, shader, vao, &mut filter); // FilterChain::load_from_path("../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", None)
.unwrap();
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();
let mut filter = FilterChainGL::load_from_path( unsafe {
// "../test/slang-shaders/vhs/VHSPro.slangp", let mut filter = FilterChainGL::load_from_path(
// "../test/slang-shaders/test/history.slangp", // "../test/slang-shaders/vhs/VHSPro.slangp",
// "../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", // "../test/slang-shaders/test/history.slangp",
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", // "../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
Some(&FilterChainOptionsGL { "../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
glsl_version: 0, Some(&FilterChainOptionsGL {
use_dsa: true, glsl_version: 0,
force_no_mipmaps: false, use_dsa: true,
disable_cache: false, force_no_mipmaps: false,
}), disable_cache: false,
) }),
// FilterChain::load_from_path("../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", None) )
.unwrap(); // FilterChain::load_from_path("../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", None)
hello_triangle::gl46::do_loop(glfw, window, events, shader, vao, &mut filter); .unwrap();
hello_triangle::gl46::do_loop(glfw, window, events, shader, vao, &mut filter);
}
} }

View file

@ -8,22 +8,25 @@ 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();
let filter = FilterChainVulkan::load_from_path(
// "../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",
&base,
// "../test/slang-shaders/test/feedback.slancargogp",
// "../test/basic.slangp",
Some(&FilterChainOptionsVulkan {
frames_in_flight: 3,
force_no_mipmaps: false,
use_render_pass: true,
disable_cache: false,
}),
)
.unwrap();
hello_triangle::main(base, filter) unsafe {
let filter = FilterChainVulkan::load_from_path(
// "../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",
&base,
// "../test/slang-shaders/test/feedback.slancargogp",
// "../test/basic.slangp",
Some(&FilterChainOptionsVulkan {
frames_in_flight: 3,
force_no_mipmaps: false,
use_render_pass: true,
disable_cache: false,
}),
)
.unwrap();
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(