-
Notifications
You must be signed in to change notification settings - Fork 11
/
triangle.rs
81 lines (70 loc) · 2.84 KB
/
triangle.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
mod hello_triangle;
use librashader_runtime::image::{Image, UVDirection};
use librashader_runtime_d3d11::options::FilterChainOptionsD3D11;
// "../test/slang-shaders/scalefx/scalefx-9x.slangp",
// "../test/slang-shaders/bezel/koko-aio/monitor-bloom.slangp",
// "../test/slang-shaders/presets/crt-geom-ntsc-upscale-sharp.slangp",
// const FILTER_PATH: &str =
// "../test/slang-shaders/handheld/console-border/gbc-lcd-grid-v2.slangp";
// "../test/null.slangp",
// const FILTER_PATH: &str =
// "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_GBA_SP/GBA_SP-[ADV]-[LCD-GRID].slangp";
// const FILTER_PATH: &str = "../test/shaders_slang/crt/crt-royale.slangp";
// const FILTER_PATH: &str = "../test/slang-shaders/test/history.slangp";
// const FILTER_PATH: &str = "../test/shaders_slang/test/feedback.slangp";
const FILTER_PATH: &str = "../test/aspect.slangp";
const IMAGE_PATH: &str = "../triangle.png";
#[test]
fn triangle_d3d11_args() {
let mut args = std::env::args();
let _ = args.next();
let _ = args.next();
let filter = args.next();
let image = args
.next()
.and_then(|f| Image::load(f, UVDirection::TopLeft).ok())
.or_else(|| Some(Image::load(IMAGE_PATH, UVDirection::TopLeft).unwrap()))
.unwrap();
let sample = hello_triangle::d3d11_hello_triangle::Sample::new(
filter.as_deref().unwrap_or(FILTER_PATH),
Some(&FilterChainOptionsD3D11 {
force_no_mipmaps: false,
disable_cache: false,
}),
// replace below with 'None' for the triangle
Some(image),
)
.unwrap();
// let sample = hello_triangle_old::d3d11_hello_triangle::Sample::new(
// "../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
// Some(&FilterChainOptions {
// use_deferred_context: true,
// })
// )
// .unwrap();
// let sample = hello_triangle_old::d3d11_hello_triangle::Sample::new("../test/basic.slangp").unwrap();
hello_triangle::main(sample).unwrap();
}
#[test]
fn triangle_d3d11() {
let sample = hello_triangle::d3d11_hello_triangle::Sample::new(
FILTER_PATH,
Some(&FilterChainOptionsD3D11 {
force_no_mipmaps: false,
disable_cache: true,
}),
// replace below with 'None' for the triangle
// None,
Some(Image::load(IMAGE_PATH, UVDirection::TopLeft).unwrap()),
)
.unwrap();
// let sample = hello_triangle_old::d3d11_hello_triangle::Sample::new(
// "../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
// Some(&FilterChainOptions {
// use_deferred_context: true,
// })
// )
// .unwrap();
// let sample = hello_triangle_old::d3d11_hello_triangle::Sample::new("../test/basic.slangp").unwrap();
hello_triangle::main(sample).unwrap();
}