Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ee0e0c2b5f | |||
| 18fdec939c |
Generated
+25
-25
@@ -318,7 +318,7 @@ checksum = "cb9f6e1368bd4621d2c86baa7e37de77a938adf5221e5dd3d6133340101b309e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
"polling",
|
"polling",
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.3",
|
||||||
"slab",
|
"slab",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
@@ -342,7 +342,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa"
|
checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"calloop 0.14.3",
|
"calloop 0.14.3",
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.3",
|
||||||
"wayland-backend",
|
"wayland-backend",
|
||||||
"wayland-client",
|
"wayland-client",
|
||||||
]
|
]
|
||||||
@@ -859,7 +859,7 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"
|
checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.3",
|
||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1050,7 +1050,7 @@ dependencies = [
|
|||||||
"rgb",
|
"rgb",
|
||||||
"tiff",
|
"tiff",
|
||||||
"zune-core 0.5.0",
|
"zune-core 0.5.0",
|
||||||
"zune-jpeg 0.5.7",
|
"zune-jpeg 0.5.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1121,9 +1121,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.15"
|
version = "1.0.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jni"
|
name = "jni"
|
||||||
@@ -1943,7 +1943,7 @@ dependencies = [
|
|||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
"hermit-abi",
|
"hermit-abi",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.3",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2246,9 +2246,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "1.1.2"
|
version = "1.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e"
|
checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
"errno",
|
"errno",
|
||||||
@@ -2263,12 +2263,6 @@ version = "1.0.22"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ryu"
|
|
||||||
version = "1.0.20"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "same-file"
|
name = "same-file"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
@@ -2335,15 +2329,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.145"
|
version = "1.0.147"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
|
checksum = "6af14725505314343e673e9ecb7cd7e8a36aa9791eb936235a3567cc31447ae4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
"ryu",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
|
"zmij",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2455,7 +2449,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"memmap2",
|
"memmap2",
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.3",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
"wayland-backend",
|
"wayland-backend",
|
||||||
"wayland-client",
|
"wayland-client",
|
||||||
@@ -2983,7 +2977,7 @@ checksum = "673a33c33048a5ade91a6b139580fa174e19fb0d23f396dca9fa15f2e1e49b35"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"downcast-rs",
|
"downcast-rs",
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.3",
|
||||||
"scoped-tls",
|
"scoped-tls",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"wayland-sys",
|
"wayland-sys",
|
||||||
@@ -2996,7 +2990,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "c66a47e840dc20793f2264eb4b3e4ecb4b75d91c0dd4af04b456128e0bdd449d"
|
checksum = "c66a47e840dc20793f2264eb4b3e4ecb4b75d91c0dd4af04b456128e0bdd449d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.3",
|
||||||
"wayland-backend",
|
"wayland-backend",
|
||||||
"wayland-scanner",
|
"wayland-scanner",
|
||||||
]
|
]
|
||||||
@@ -3018,7 +3012,7 @@ version = "0.31.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "447ccc440a881271b19e9989f75726d60faa09b95b0200a9b7eb5cc47c3eeb29"
|
checksum = "447ccc440a881271b19e9989f75726d60faa09b95b0200a9b7eb5cc47c3eeb29"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.3",
|
||||||
"wayland-client",
|
"wayland-client",
|
||||||
"xcursor",
|
"xcursor",
|
||||||
]
|
]
|
||||||
@@ -3493,7 +3487,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"libloading",
|
"libloading",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.3",
|
||||||
"x11rb-protocol",
|
"x11rb-protocol",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3643,6 +3637,12 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zmij"
|
||||||
|
version = "0.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d0095ecd462946aa3927d9297b63ef82fb9a5316d7a37d134eeb36e58228615a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zune-core"
|
name = "zune-core"
|
||||||
version = "0.4.12"
|
version = "0.4.12"
|
||||||
@@ -3675,9 +3675,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zune-jpeg"
|
name = "zune-jpeg"
|
||||||
version = "0.5.7"
|
version = "0.5.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "51d915729b0e7d5fe35c2f294c5dc10b30207cc637920e5b59077bfa3da63f28"
|
checksum = "e35aee689668bf9bd6f6f3a6c60bb29ba1244b3b43adfd50edd554a371da37d5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zune-core 0.5.0",
|
"zune-core 0.5.0",
|
||||||
]
|
]
|
||||||
|
|||||||
+3
-4
@@ -1,4 +1,4 @@
|
|||||||
use std::{fs::read_dir, io::Write, process::Command};
|
use std::{fs::read_dir, process::Command};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
//let mut output = std::fs::File::create("output.txt").unwrap();
|
//let mut output = std::fs::File::create("output.txt").unwrap();
|
||||||
@@ -8,8 +8,8 @@ fn main() {
|
|||||||
|
|
||||||
let paths = read_dir("src/shaders").unwrap();
|
let paths = read_dir("src/shaders").unwrap();
|
||||||
for path in paths {
|
for path in paths {
|
||||||
if let Ok(path) = path {
|
if let Ok(path) = path
|
||||||
if path
|
&& path
|
||||||
.path()
|
.path()
|
||||||
.extension()
|
.extension()
|
||||||
.map(|ext| ext == "glsl")
|
.map(|ext| ext == "glsl")
|
||||||
@@ -20,7 +20,6 @@ fn main() {
|
|||||||
// path.path().display()).unwrap();
|
// path.path().display()).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Command::new("python3")
|
Command::new("python3")
|
||||||
.arg("assemble_trace.py")
|
.arg("assemble_trace.py")
|
||||||
|
|||||||
+37
-44
@@ -10,8 +10,8 @@ const DEFAULT_SUBDIVISION: u32 = 16;
|
|||||||
const MAXIMUM_SUBDIVISION: u32 = 64;
|
const MAXIMUM_SUBDIVISION: u32 = 64;
|
||||||
const MINUMUM_SUBDIVISION: u32 = 8;
|
const MINUMUM_SUBDIVISION: u32 = 8;
|
||||||
|
|
||||||
const RUN_STANDARD_PIPELINE: bool = false;
|
const RUN_STANDARD_PIPELINE: bool = true;
|
||||||
const RUN_RT_PIPELINE: bool = true;
|
const RUN_RT_PIPELINE: bool = false;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
error::Error,
|
error::Error,
|
||||||
@@ -417,7 +417,7 @@ impl App {
|
|||||||
Format::D16_UNORM_S8_UINT,
|
Format::D16_UNORM_S8_UINT,
|
||||||
];
|
];
|
||||||
|
|
||||||
let depth_format = (if IGNORE_STENCIL {
|
let depth_format = *(if IGNORE_STENCIL {
|
||||||
DEPTH_FORMAT_ORDERING_IGNORE_STENCIL.iter()
|
DEPTH_FORMAT_ORDERING_IGNORE_STENCIL.iter()
|
||||||
} else {
|
} else {
|
||||||
DEPTH_FORMAT_ORDERING.iter()
|
DEPTH_FORMAT_ORDERING.iter()
|
||||||
@@ -430,8 +430,7 @@ impl App {
|
|||||||
.contains(FormatFeatures::DEPTH_STENCIL_ATTACHMENT)
|
.contains(FormatFeatures::DEPTH_STENCIL_ATTACHMENT)
|
||||||
})
|
})
|
||||||
.next()
|
.next()
|
||||||
.expect("Could not find suitable depth format!")
|
.expect("Could not find suitable depth format!");
|
||||||
.clone();
|
|
||||||
|
|
||||||
info!("Using depth format {:?}", depth_format);
|
info!("Using depth format {:?}", depth_format);
|
||||||
|
|
||||||
@@ -619,12 +618,9 @@ impl App {
|
|||||||
move |res: Result<notify::Event, notify::Error>| match res {
|
move |res: Result<notify::Event, notify::Error>| match res {
|
||||||
Ok(event) => {
|
Ok(event) => {
|
||||||
//info!("event: {:?}", event);
|
//info!("event: {:?}", event);
|
||||||
match event.kind {
|
if let notify::EventKind::Modify(_) = event.kind {
|
||||||
notify::EventKind::Modify(_) => {
|
|
||||||
info!("event: {:?}", event);
|
info!("event: {:?}", event);
|
||||||
watcher_glsl_changed.store(true, std::sync::atomic::Ordering::Relaxed);
|
watcher_glsl_changed.store(true, std::sync::atomic::Ordering::Relaxed);
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => error!("watch error: {:?}", e),
|
Err(e) => error!("watch error: {:?}", e),
|
||||||
@@ -758,7 +754,8 @@ impl ApplicationHandler for App {
|
|||||||
.surface_present_modes(&surface, Default::default())
|
.surface_present_modes(&surface, Default::default())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let present_mode = present_modes
|
|
||||||
|
present_modes
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.min_by_key(|p| {
|
.min_by_key(|p| {
|
||||||
// We assign a lower score to device types that are likely to be
|
// We assign a lower score to device types that are likely to be
|
||||||
@@ -771,8 +768,7 @@ impl ApplicationHandler for App {
|
|||||||
_ => 4,
|
_ => 4,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap()
|
||||||
present_mode
|
|
||||||
};
|
};
|
||||||
|
|
||||||
info!("Using present mode {:?}.", present_mode);
|
info!("Using present mode {:?}.", present_mode);
|
||||||
@@ -965,7 +961,7 @@ impl ApplicationHandler for App {
|
|||||||
|
|
||||||
let viewport = Viewport {
|
let viewport = Viewport {
|
||||||
offset: [0.0, window_size.height as f32],
|
offset: [0.0, window_size.height as f32],
|
||||||
extent: [window_size.width as f32, window_size.height as f32 * -1.],
|
extent: [window_size.width as f32, -(window_size.height as f32)],
|
||||||
depth_range: 0.0..=1.0,
|
depth_range: 0.0..=1.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1076,15 +1072,14 @@ impl ApplicationHandler for App {
|
|||||||
_device_id: winit::event::DeviceId,
|
_device_id: winit::event::DeviceId,
|
||||||
event: DeviceEvent,
|
event: DeviceEvent,
|
||||||
) {
|
) {
|
||||||
if let DeviceEvent::MouseMotion { delta } = &event {
|
if let DeviceEvent::MouseMotion { delta } = &event
|
||||||
if self.cstate.looking {
|
&& self.cstate.looking {
|
||||||
self.cstate.forward.x += delta.1 as f32 * self.gstate.cursor_sensitivity * 0.3;
|
self.cstate.forward.x += delta.1 as f32 * self.gstate.cursor_sensitivity * 0.3;
|
||||||
self.cstate.forward.y += delta.0 as f32 * self.gstate.cursor_sensitivity * 0.3;
|
self.cstate.forward.y += delta.0 as f32 * self.gstate.cursor_sensitivity * 0.3;
|
||||||
self.cstate.forward.x += 360f32 % 360f32;
|
self.cstate.forward.x += 360f32 % 360f32;
|
||||||
self.cstate.forward.y += 360f32 % 360f32;
|
self.cstate.forward.y += 360f32 % 360f32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn window_event(
|
fn window_event(
|
||||||
&mut self,
|
&mut self,
|
||||||
@@ -1095,11 +1090,10 @@ impl ApplicationHandler for App {
|
|||||||
let rcx_clone = self.rcx.clone();
|
let rcx_clone = self.rcx.clone();
|
||||||
let mut rcx_lock = rcx_clone.lock().unwrap();
|
let mut rcx_lock = rcx_clone.lock().unwrap();
|
||||||
let rcx = rcx_lock.as_mut().unwrap();
|
let rcx = rcx_lock.as_mut().unwrap();
|
||||||
if self.draw_gui {
|
if self.draw_gui
|
||||||
if rcx.gui.update(&event) {
|
&& rcx.gui.update(&event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
match &event {
|
match &event {
|
||||||
WindowEvent::CloseRequested => {
|
WindowEvent::CloseRequested => {
|
||||||
event_loop.exit();
|
event_loop.exit();
|
||||||
@@ -1168,7 +1162,7 @@ impl ApplicationHandler for App {
|
|||||||
rcx.render_pass.clone(),
|
rcx.render_pass.clone(),
|
||||||
self.pipeline_cache.clone(),
|
self.pipeline_cache.clone(),
|
||||||
rcx.shader_modules.clone(),
|
rcx.shader_modules.clone(),
|
||||||
self.previous_debug.clone(),
|
self.previous_debug,
|
||||||
self.block_enable_allocator.clone(),
|
self.block_enable_allocator.clone(),
|
||||||
self.host_visible_allocator.clone(),
|
self.host_visible_allocator.clone(),
|
||||||
self.descriptor_set_allocator.clone(),
|
self.descriptor_set_allocator.clone(),
|
||||||
@@ -1207,32 +1201,32 @@ impl App {
|
|||||||
if self.cstate.looking {
|
if self.cstate.looking {
|
||||||
if self.cstate.keys.w {
|
if self.cstate.keys.w {
|
||||||
self.cstate.position -=
|
self.cstate.position -=
|
||||||
Mat3::from_rotation_y(self.cstate.forward.y.to_radians() * -1.)
|
Mat3::from_rotation_y(-self.cstate.forward.y.to_radians())
|
||||||
* Mat3::from_rotation_x(self.cstate.forward.x.to_radians() * -1.)
|
* Mat3::from_rotation_x(-self.cstate.forward.x.to_radians())
|
||||||
* Vec3::Z
|
* Vec3::Z
|
||||||
* 0.01
|
* 0.01
|
||||||
* self.gstate.move_speed;
|
* self.gstate.move_speed;
|
||||||
}
|
}
|
||||||
if self.cstate.keys.s {
|
if self.cstate.keys.s {
|
||||||
self.cstate.position +=
|
self.cstate.position +=
|
||||||
Mat3::from_rotation_y(self.cstate.forward.y.to_radians() * -1.)
|
Mat3::from_rotation_y(-self.cstate.forward.y.to_radians())
|
||||||
* Mat3::from_rotation_x(self.cstate.forward.x.to_radians() * -1.)
|
* Mat3::from_rotation_x(-self.cstate.forward.x.to_radians())
|
||||||
* Vec3::Z
|
* Vec3::Z
|
||||||
* 0.01
|
* 0.01
|
||||||
* self.gstate.move_speed;
|
* self.gstate.move_speed;
|
||||||
}
|
}
|
||||||
if self.cstate.keys.a {
|
if self.cstate.keys.a {
|
||||||
self.cstate.position -=
|
self.cstate.position -=
|
||||||
Mat3::from_rotation_y(self.cstate.forward.y.to_radians() * -1.)
|
Mat3::from_rotation_y(-self.cstate.forward.y.to_radians())
|
||||||
* Mat3::from_rotation_x(self.cstate.forward.x.to_radians() * -1.)
|
* Mat3::from_rotation_x(-self.cstate.forward.x.to_radians())
|
||||||
* Vec3::X
|
* Vec3::X
|
||||||
* 0.01
|
* 0.01
|
||||||
* self.gstate.move_speed;
|
* self.gstate.move_speed;
|
||||||
}
|
}
|
||||||
if self.cstate.keys.d {
|
if self.cstate.keys.d {
|
||||||
self.cstate.position +=
|
self.cstate.position +=
|
||||||
Mat3::from_rotation_y(self.cstate.forward.y.to_radians() * -1.)
|
Mat3::from_rotation_y(-self.cstate.forward.y.to_radians())
|
||||||
* Mat3::from_rotation_x(self.cstate.forward.x.to_radians() * -1.)
|
* Mat3::from_rotation_x(-self.cstate.forward.x.to_radians())
|
||||||
* Vec3::X
|
* Vec3::X
|
||||||
* 0.01
|
* 0.01
|
||||||
* self.gstate.move_speed;
|
* self.gstate.move_speed;
|
||||||
@@ -1267,13 +1261,13 @@ impl App {
|
|||||||
self.cstate.position.z,
|
self.cstate.position.z,
|
||||||
self.time,
|
self.time,
|
||||||
],
|
],
|
||||||
specular: self.gstate.specular.into(),
|
specular: self.gstate.specular,
|
||||||
specular_tint: self.gstate.specular_tint.into(),
|
specular_tint: self.gstate.specular_tint,
|
||||||
sheen_tint: self.gstate.sheen_tint.into(),
|
sheen_tint: self.gstate.sheen_tint,
|
||||||
sheen: self.gstate.sheen.into(),
|
sheen: self.gstate.sheen,
|
||||||
clear_coat_gloss: self.gstate.clear_coat_gloss.into(),
|
clear_coat_gloss: self.gstate.clear_coat_gloss,
|
||||||
subsurface: self.gstate.subsurface.into(),
|
subsurface: self.gstate.subsurface,
|
||||||
clear_coat: self.gstate.clear_coat.into(),
|
clear_coat: self.gstate.clear_coat,
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.cstate.looking {
|
if self.cstate.looking {
|
||||||
@@ -1784,7 +1778,7 @@ impl App {
|
|||||||
rcx.render_pass.clone(),
|
rcx.render_pass.clone(),
|
||||||
self.pipeline_cache.clone(),
|
self.pipeline_cache.clone(),
|
||||||
rcx.shader_modules.clone(),
|
rcx.shader_modules.clone(),
|
||||||
self.previous_debug.clone(),
|
self.previous_debug,
|
||||||
i,
|
i,
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -1863,7 +1857,7 @@ impl App {
|
|||||||
rcx.render_pass.clone(),
|
rcx.render_pass.clone(),
|
||||||
self.pipeline_cache.clone(),
|
self.pipeline_cache.clone(),
|
||||||
rcx.shader_modules.clone(),
|
rcx.shader_modules.clone(),
|
||||||
self.previous_debug.clone(),
|
self.previous_debug,
|
||||||
self.block_enable_allocator.clone(),
|
self.block_enable_allocator.clone(),
|
||||||
self.host_visible_allocator.clone(),
|
self.host_visible_allocator.clone(),
|
||||||
self.descriptor_set_allocator.clone(),
|
self.descriptor_set_allocator.clone(),
|
||||||
@@ -1928,7 +1922,7 @@ impl App {
|
|||||||
);
|
);
|
||||||
|
|
||||||
rcx.viewport.extent[0] = window_size.width as f32;
|
rcx.viewport.extent[0] = window_size.width as f32;
|
||||||
rcx.viewport.extent[1] = window_size.height as f32 * -1.;
|
rcx.viewport.extent[1] = -(window_size.height as f32);
|
||||||
rcx.viewport.offset[1] = window_size.height as f32;
|
rcx.viewport.offset[1] = window_size.height as f32;
|
||||||
|
|
||||||
rcx.recreate_swapchain = false;
|
rcx.recreate_swapchain = false;
|
||||||
@@ -1953,7 +1947,7 @@ impl App {
|
|||||||
rcx.render_pass.clone(),
|
rcx.render_pass.clone(),
|
||||||
self.pipeline_cache.clone(),
|
self.pipeline_cache.clone(),
|
||||||
rcx.shader_modules.clone(),
|
rcx.shader_modules.clone(),
|
||||||
self.previous_debug.clone(),
|
self.previous_debug,
|
||||||
i,
|
i,
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -2108,7 +2102,7 @@ impl App {
|
|||||||
.boxed();
|
.boxed();
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.gstate.csg.len() > 0 {
|
if !self.gstate.csg.is_empty() {
|
||||||
self.add_commands_depth_pass(
|
self.add_commands_depth_pass(
|
||||||
&mut builder,
|
&mut builder,
|
||||||
&push_constants,
|
&push_constants,
|
||||||
@@ -2117,7 +2111,7 @@ impl App {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
self.add_commands_primary_subpass(&mut builder);
|
self.add_commands_primary_subpass(&mut builder);
|
||||||
if self.gstate.csg.len() > 0 {
|
if !self.gstate.csg.is_empty() {
|
||||||
self.add_commands_normal_pass(
|
self.add_commands_normal_pass(
|
||||||
&mut builder,
|
&mut builder,
|
||||||
&push_constants,
|
&push_constants,
|
||||||
@@ -2645,8 +2639,8 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn dump_pipeline_cache(cache: Arc<PipelineCache>) {
|
fn dump_pipeline_cache(cache: Arc<PipelineCache>) {
|
||||||
if PIPELINE_CACHING {
|
if PIPELINE_CACHING
|
||||||
if let Ok(data) = cache.get_data() {
|
&& let Ok(data) = cache.get_data() {
|
||||||
info!("Dumping pipeline cache...");
|
info!("Dumping pipeline cache...");
|
||||||
let tmp_path = relpath("pipeline_cache.bin.tmp");
|
let tmp_path = relpath("pipeline_cache.bin.tmp");
|
||||||
|
|
||||||
@@ -2661,7 +2655,6 @@ fn dump_pipeline_cache(cache: Arc<PipelineCache>) {
|
|||||||
info!("Pipeline cache dump exit");
|
info!("Pipeline cache dump exit");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn get_pipeline_cache(device: Arc<Device>) -> Arc<PipelineCache> {
|
fn get_pipeline_cache(device: Arc<Device>) -> Arc<PipelineCache> {
|
||||||
let initial_data = {
|
let initial_data = {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ pub(crate) struct Mesh {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct CSG {
|
pub(crate) struct CSG {
|
||||||
pub(crate) name: String,
|
pub(crate) name: String,
|
||||||
pub(crate) seed: u64,
|
pub(crate) _seed: u64,
|
||||||
pub(crate) parts: SSATape,
|
pub(crate) parts: SSATape,
|
||||||
pub(crate) pos: Vec3,
|
pub(crate) pos: Vec3,
|
||||||
pub(crate) rot: Vec3,
|
pub(crate) rot: Vec3,
|
||||||
|
|||||||
@@ -116,12 +116,12 @@ pub fn thread_loop(recv: mpmc::Receiver<WorkItem>, send: mpsc::SyncSender<WorkCo
|
|||||||
let parts = create_csg(seed);
|
let parts = create_csg(seed);
|
||||||
|
|
||||||
let trace_shader_module =
|
let trace_shader_module =
|
||||||
sdf_specialize_module(device.clone(), &parts, trace_module, &format!("trace"));
|
sdf_specialize_module(device.clone(), &parts, trace_module, "trace");
|
||||||
let normals_shader_module = sdf_specialize_module(
|
let normals_shader_module = sdf_specialize_module(
|
||||||
device.clone(),
|
device.clone(),
|
||||||
&parts,
|
&parts,
|
||||||
normals_module,
|
normals_module,
|
||||||
&format!("normals"),
|
"normals",
|
||||||
);
|
);
|
||||||
|
|
||||||
let (trace_pipeline, normals_pipeline) = deferred_pipelines_recompile(
|
let (trace_pipeline, normals_pipeline) = deferred_pipelines_recompile(
|
||||||
@@ -135,7 +135,6 @@ pub fn thread_loop(recv: mpmc::Receiver<WorkItem>, send: mpsc::SyncSender<WorkCo
|
|||||||
);
|
);
|
||||||
|
|
||||||
let enable_buffer: Vec<Subbuffer<Object>> = (0..frames)
|
let enable_buffer: Vec<Subbuffer<Object>> = (0..frames)
|
||||||
.into_iter()
|
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
block_enable_allocator
|
block_enable_allocator
|
||||||
.lock()
|
.lock()
|
||||||
@@ -145,7 +144,6 @@ pub fn thread_loop(recv: mpmc::Receiver<WorkItem>, send: mpsc::SyncSender<WorkCo
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let enable_buffer_host_visible: Vec<Subbuffer<Object>> = (0..frames)
|
let enable_buffer_host_visible: Vec<Subbuffer<Object>> = (0..frames)
|
||||||
.into_iter()
|
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
host_visible_allocator
|
host_visible_allocator
|
||||||
.lock()
|
.lock()
|
||||||
@@ -157,7 +155,6 @@ pub fn thread_loop(recv: mpmc::Receiver<WorkItem>, send: mpsc::SyncSender<WorkCo
|
|||||||
|
|
||||||
let trace_layout = trace_pipeline.layout().set_layouts()[1].clone();
|
let trace_layout = trace_pipeline.layout().set_layouts()[1].clone();
|
||||||
let trace_descriptor_set = (0..frames)
|
let trace_descriptor_set = (0..frames)
|
||||||
.into_iter()
|
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
DescriptorSet::new(
|
DescriptorSet::new(
|
||||||
descriptor_set_allocator.clone(),
|
descriptor_set_allocator.clone(),
|
||||||
@@ -174,7 +171,6 @@ pub fn thread_loop(recv: mpmc::Receiver<WorkItem>, send: mpsc::SyncSender<WorkCo
|
|||||||
|
|
||||||
let normals_layout = normals_pipeline.layout().set_layouts()[1].clone();
|
let normals_layout = normals_pipeline.layout().set_layouts()[1].clone();
|
||||||
let normals_descriptor_set = (0..frames)
|
let normals_descriptor_set = (0..frames)
|
||||||
.into_iter()
|
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
DescriptorSet::new(
|
DescriptorSet::new(
|
||||||
descriptor_set_allocator.clone(),
|
descriptor_set_allocator.clone(),
|
||||||
@@ -191,7 +187,7 @@ pub fn thread_loop(recv: mpmc::Receiver<WorkItem>, send: mpsc::SyncSender<WorkCo
|
|||||||
|
|
||||||
let csg = Arc::new(RwLock::new(CSG {
|
let csg = Arc::new(RwLock::new(CSG {
|
||||||
name: "example".to_string(),
|
name: "example".to_string(),
|
||||||
seed,
|
_seed: seed,
|
||||||
parts,
|
parts,
|
||||||
pos: Vec3::ZERO,
|
pos: Vec3::ZERO,
|
||||||
rot: Vec3::ZERO,
|
rot: Vec3::ZERO,
|
||||||
@@ -276,13 +272,13 @@ pub fn thread_loop(recv: mpmc::Receiver<WorkItem>, send: mpsc::SyncSender<WorkCo
|
|||||||
device.clone(),
|
device.clone(),
|
||||||
&csg.parts,
|
&csg.parts,
|
||||||
trace_module,
|
trace_module,
|
||||||
&format!("trace"),
|
"trace",
|
||||||
);
|
);
|
||||||
csg.normals_shader_module = sdf_specialize_module(
|
csg.normals_shader_module = sdf_specialize_module(
|
||||||
device.clone(),
|
device.clone(),
|
||||||
&csg.parts,
|
&csg.parts,
|
||||||
normals_module,
|
normals_module,
|
||||||
&format!("normals"),
|
"normals",
|
||||||
);
|
);
|
||||||
|
|
||||||
(csg.trace_pipeline, csg.normals_pipeline) = deferred_pipelines_recompile(
|
(csg.trace_pipeline, csg.normals_pipeline) = deferred_pipelines_recompile(
|
||||||
@@ -566,7 +562,7 @@ fn interval_check(
|
|||||||
material,
|
material,
|
||||||
subdivision_log2: csg.subdivision.ilog2(),
|
subdivision_log2: csg.subdivision.ilog2(),
|
||||||
farplane: ((highest_corner - lowest_corner).length() / csg.subdivision as f32).into(),
|
farplane: ((highest_corner - lowest_corner).length() / csg.subdivision as f32).into(),
|
||||||
colour: csg.colour.to_array().into(),
|
colour: csg.colour.to_array(),
|
||||||
roughness: csg.roughness,
|
roughness: csg.roughness,
|
||||||
metallic: csg.metallic,
|
metallic: csg.metallic,
|
||||||
};
|
};
|
||||||
@@ -673,14 +669,13 @@ fn sdf_specialize_module(
|
|||||||
let module_as_bytes = assembled_module
|
let module_as_bytes = assembled_module
|
||||||
.iter()
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.map(u32::to_le_bytes)
|
.flat_map(u32::to_le_bytes)
|
||||||
.flatten()
|
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
if DUMP_SPV_TO_FILE {
|
if DUMP_SPV_TO_FILE {
|
||||||
File::create(format!("{name}.out.spv"))
|
File::create(format!("{name}.out.spv"))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.write(&module_as_bytes)
|
.write_all(&module_as_bytes)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ pub enum InstructionSet {
|
|||||||
OPPosition = ((1 * 64) + 63),
|
OPPosition = ((1 * 64) + 63),
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
#[allow(clippy::erasing_op)]
|
||||||
/// Calculates the minimum of two Vec1s, and also carries over the relevant
|
/// Calculates the minimum of two Vec1s, and also carries over the relevant
|
||||||
/// material metadata.
|
/// material metadata.
|
||||||
OPMinMaterial = ((0 * 64) + 63),
|
OPMinMaterial = ((0 * 64) + 63),
|
||||||
|
|||||||
@@ -69,30 +69,10 @@ impl<'csg> IntervalInterpreter<'csg> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_four(
|
|
||||||
&mut self,
|
|
||||||
instruction: &SSAInstruction,
|
|
||||||
func: impl Fn(Interval, Interval, Interval, Interval) -> Interval,
|
|
||||||
) {
|
|
||||||
for i in 0..instruction.opcode.size as usize {
|
|
||||||
let val_a = self.load(instruction.inputs[i]);
|
|
||||||
let val_b = self.load(instruction.inputs[i + instruction.opcode.size as usize]);
|
|
||||||
let val_c = self.load(instruction.inputs[i + (instruction.opcode.size * 2) as usize]);
|
|
||||||
let val_d = self.load(instruction.inputs[i + (instruction.opcode.size * 3) as usize]);
|
|
||||||
self.store(instruction.outputs[i], func(val_a, val_b, val_c, val_d));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// cargo asm "tape-drive::interpreter::IntervalInterpreter::scene" --no-color
|
// cargo asm "tape-drive::interpreter::IntervalInterpreter::scene" --no-color
|
||||||
// --rust > scene.asm
|
// --rust > scene.asm
|
||||||
|
|
||||||
pub fn scene(
|
pub fn scene(&mut self, px: Interval, py: Interval, pz: Interval, time: Interval) -> Interval {
|
||||||
&mut self,
|
|
||||||
px: Interval,
|
|
||||||
py: Interval,
|
|
||||||
pz: Interval,
|
|
||||||
time: Interval,
|
|
||||||
) -> Interval {
|
|
||||||
self.clear_stacks();
|
self.clear_stacks();
|
||||||
|
|
||||||
for instruction in &self.csg.tape {
|
for instruction in &self.csg.tape {
|
||||||
|
|||||||
@@ -68,20 +68,6 @@ impl<'csg> PointInterpreter<'csg> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_four(
|
|
||||||
&mut self,
|
|
||||||
instruction: &SSAInstruction,
|
|
||||||
func: impl Fn(Value, Value, Value, Value) -> Value,
|
|
||||||
) {
|
|
||||||
for i in 0..instruction.opcode.size as usize {
|
|
||||||
let val_a = self.load(instruction.inputs[i]);
|
|
||||||
let val_b = self.load(instruction.inputs[i + instruction.opcode.size as usize]);
|
|
||||||
let val_c = self.load(instruction.inputs[i + (instruction.opcode.size * 2) as usize]);
|
|
||||||
let val_d = self.load(instruction.inputs[i + (instruction.opcode.size * 3) as usize]);
|
|
||||||
self.store(instruction.outputs[i], func(val_a, val_b, val_c, val_d));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// cargo asm "tape-drive::interpreter::PointInterpreter::scene" --no-color
|
// cargo asm "tape-drive::interpreter::PointInterpreter::scene" --no-color
|
||||||
// --rust > scene.asm
|
// --rust > scene.asm
|
||||||
|
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ pub mod types;
|
|||||||
pub mod vm;
|
pub mod vm;
|
||||||
|
|
||||||
const BYTECODE_IMITATES_GLSL: bool = false;
|
const BYTECODE_IMITATES_GLSL: bool = false;
|
||||||
const DUMP_SPV_DIS_TO_FILE: bool = false;
|
const DUMP_SPV_DIS_TO_FILE: bool = true;
|
||||||
|
|||||||
@@ -111,43 +111,6 @@ pub(crate) fn compile_interval_function(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_four(
|
|
||||||
float: u32,
|
|
||||||
b: &mut rspirv::dr::Builder,
|
|
||||||
mapping: &mut HashMap<u32, (u32, u32)>,
|
|
||||||
instruction: &SSAInstruction,
|
|
||||||
func: impl Fn(
|
|
||||||
&mut rspirv::dr::Builder,
|
|
||||||
(u32, u32),
|
|
||||||
(u32, u32),
|
|
||||||
(u32, u32),
|
|
||||||
(u32, u32),
|
|
||||||
) -> (u32, u32),
|
|
||||||
) {
|
|
||||||
for i in 0..instruction.opcode.size as usize {
|
|
||||||
let val_a = input_resolve(float, b, &mapping, instruction.inputs[i]);
|
|
||||||
let val_b = input_resolve(
|
|
||||||
float,
|
|
||||||
b,
|
|
||||||
&mapping,
|
|
||||||
instruction.inputs[i + instruction.opcode.size as usize],
|
|
||||||
);
|
|
||||||
let val_c = input_resolve(
|
|
||||||
float,
|
|
||||||
b,
|
|
||||||
&mapping,
|
|
||||||
instruction.inputs[i + (instruction.opcode.size as usize * 2)],
|
|
||||||
);
|
|
||||||
let val_d = input_resolve(
|
|
||||||
float,
|
|
||||||
b,
|
|
||||||
&mapping,
|
|
||||||
instruction.inputs[i + (instruction.opcode.size as usize * 3)],
|
|
||||||
);
|
|
||||||
mapping.insert(instruction.outputs[i], func(b, val_a, val_b, val_c, val_d));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn multiply(
|
fn multiply(
|
||||||
float: u32,
|
float: u32,
|
||||||
b: &mut rspirv::dr::Builder,
|
b: &mut rspirv::dr::Builder,
|
||||||
@@ -964,7 +927,7 @@ pub(crate) fn compile_interval_function(
|
|||||||
b,
|
b,
|
||||||
&mut mapping,
|
&mut mapping,
|
||||||
instruction,
|
instruction,
|
||||||
|b, val_a, val_b| {
|
|b, _val_a, _val_b| {
|
||||||
let pi_const =
|
let pi_const =
|
||||||
b.constant_bit32(types.float, (std::f32::consts::PI).to_bits());
|
b.constant_bit32(types.float, (std::f32::consts::PI).to_bits());
|
||||||
let npi_const =
|
let npi_const =
|
||||||
@@ -1028,39 +991,29 @@ pub(crate) fn compile_interval_function(
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let dot = match instruction.opcode.size {
|
let dot = match instruction.opcode.size {
|
||||||
1 => multiply(types.float, b, types.glsl, val_a[0], val_b[0]),
|
1 => multiply(types.float, b, types.glsl, val_a[0], val_b[0]),
|
||||||
2 => add(
|
2 => {
|
||||||
types.float,
|
let mulx = multiply(types.float, b, types.glsl, val_a[0], val_b[0]);
|
||||||
b,
|
let muly = multiply(types.float, b, types.glsl, val_a[1], val_b[1]);
|
||||||
multiply(types.float, b, types.glsl, val_a[0], val_b[0]),
|
add(types.float, b, mulx, muly)
|
||||||
multiply(types.float, b, types.glsl, val_a[1], val_b[1]),
|
},
|
||||||
),
|
3 => {
|
||||||
3 => add(
|
let mulx = multiply(types.float, b, types.glsl, val_a[0], val_b[0]);
|
||||||
types.float,
|
let muly = multiply(types.float, b, types.glsl, val_a[1], val_b[1]);
|
||||||
b,
|
let mulz = multiply(types.float, b, types.glsl, val_a[2], val_b[2]);
|
||||||
add(
|
let accum = add(types.float, b, mulx, muly);
|
||||||
types.float,
|
let accum = add(types.float, b, accum, mulz);
|
||||||
b,
|
accum
|
||||||
multiply(types.float, b, types.glsl, val_a[0], val_b[0]),
|
},
|
||||||
multiply(types.float, b, types.glsl, val_a[1], val_b[1]),
|
4 => {
|
||||||
),
|
let mulx = multiply(types.float, b, types.glsl, val_a[0], val_b[0]);
|
||||||
multiply(types.float, b, types.glsl, val_a[2], val_b[2]),
|
let muly = multiply(types.float, b, types.glsl, val_a[1], val_b[1]);
|
||||||
),
|
let mulz = multiply(types.float, b, types.glsl, val_a[2], val_b[2]);
|
||||||
4 => add(
|
let mulw = multiply(types.float, b, types.glsl, val_a[3], val_b[3]);
|
||||||
types.float,
|
let accum = add(types.float, b, mulx, muly);
|
||||||
b,
|
let accum = add(types.float, b, accum, mulz);
|
||||||
add(
|
let accum = add(types.float, b, accum, mulw);
|
||||||
types.float,
|
accum
|
||||||
b,
|
},
|
||||||
add(
|
|
||||||
types.float,
|
|
||||||
b,
|
|
||||||
multiply(types.float, b, types.glsl, val_a[0], val_b[0]),
|
|
||||||
multiply(types.float, b, types.glsl, val_a[1], val_b[1]),
|
|
||||||
),
|
|
||||||
multiply(types.float, b, types.glsl, val_a[2], val_b[2]),
|
|
||||||
),
|
|
||||||
multiply(types.float, b, types.glsl, val_a[3], val_b[3]),
|
|
||||||
),
|
|
||||||
_ => unreachable!("Invalid opcode size {}", instruction.opcode.size),
|
_ => unreachable!("Invalid opcode size {}", instruction.opcode.size),
|
||||||
};
|
};
|
||||||
mapping.insert(instruction.outputs[0], dot);
|
mapping.insert(instruction.outputs[0], dot);
|
||||||
@@ -1187,45 +1140,31 @@ pub(crate) fn compile_interval_function(
|
|||||||
param_one(types.float, b, &mut mapping, instruction, |b, val_a| {
|
param_one(types.float, b, &mut mapping, instruction, |b, val_a| {
|
||||||
let zero = b.constant_bit32(types.float, (0.0f32).to_bits());
|
let zero = b.constant_bit32(types.float, (0.0f32).to_bits());
|
||||||
let one = b.constant_bit32(types.float, (1.0f32).to_bits());
|
let one = b.constant_bit32(types.float, (1.0f32).to_bits());
|
||||||
|
let ge1 = b.f_sub(types.float, None, val_a.1, val_a.0).unwrap();
|
||||||
let ge1 = b
|
let ge1 = b
|
||||||
.f_ord_greater_than_equal(
|
.f_ord_greater_than_equal(types.bool, None, ge1, one)
|
||||||
types.bool,
|
|
||||||
None,
|
|
||||||
b.f_sub(types.float, None, val_a.1, val_a.0).unwrap(),
|
|
||||||
one,
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
(
|
let fract_low = b
|
||||||
b.select(
|
.ext_inst(
|
||||||
types.float,
|
|
||||||
None,
|
|
||||||
ge1,
|
|
||||||
zero,
|
|
||||||
b.ext_inst(
|
|
||||||
types.float,
|
types.float,
|
||||||
None,
|
None,
|
||||||
types.glsl,
|
types.glsl,
|
||||||
spirv::GLOp::Fract as u32,
|
spirv::GLOp::Fract as u32,
|
||||||
[IdRef(val_a.0)],
|
[IdRef(val_a.0)],
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap();
|
||||||
)
|
let fract_high = b
|
||||||
.unwrap(),
|
.ext_inst(
|
||||||
b.select(
|
|
||||||
types.float,
|
|
||||||
None,
|
|
||||||
ge1,
|
|
||||||
one,
|
|
||||||
b.ext_inst(
|
|
||||||
types.float,
|
types.float,
|
||||||
None,
|
None,
|
||||||
types.glsl,
|
types.glsl,
|
||||||
spirv::GLOp::Fract as u32,
|
spirv::GLOp::Fract as u32,
|
||||||
[IdRef(val_a.1)],
|
[IdRef(val_a.1)],
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap();
|
||||||
)
|
(
|
||||||
.unwrap(),
|
b.select(types.float, None, ge1, zero, fract_low).unwrap(),
|
||||||
|
b.select(types.float, None, ge1, one, fract_high).unwrap(),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -1243,22 +1182,24 @@ pub(crate) fn compile_interval_function(
|
|||||||
} else {
|
} else {
|
||||||
val_a
|
val_a
|
||||||
};
|
};
|
||||||
|
let lower_cycle = b.f_div(types.float, None, val_a.0, pi).unwrap();
|
||||||
let lower_cycle = b
|
let lower_cycle = b
|
||||||
.ext_inst(
|
.ext_inst(
|
||||||
types.float,
|
types.float,
|
||||||
None,
|
None,
|
||||||
types.glsl,
|
types.glsl,
|
||||||
spirv::GLOp::Floor as u32,
|
spirv::GLOp::Floor as u32,
|
||||||
[IdRef(b.f_div(types.float, None, val_a.0, pi).unwrap())],
|
[IdRef(lower_cycle)],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
let upper_cycle = b.f_div(types.float, None, val_a.1, pi).unwrap();
|
||||||
let upper_cycle = b
|
let upper_cycle = b
|
||||||
.ext_inst(
|
.ext_inst(
|
||||||
types.float,
|
types.float,
|
||||||
None,
|
None,
|
||||||
types.glsl,
|
types.glsl,
|
||||||
spirv::GLOp::Floor as u32,
|
spirv::GLOp::Floor as u32,
|
||||||
[IdRef(b.f_div(types.float, None, val_a.1, pi).unwrap())],
|
[IdRef(upper_cycle)],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let same_cycle = b
|
let same_cycle = b
|
||||||
@@ -1266,13 +1207,10 @@ pub(crate) fn compile_interval_function(
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let cycle = b.f_mod(types.float, None, upper_cycle, two).unwrap();
|
let cycle = b.f_mod(types.float, None, upper_cycle, two).unwrap();
|
||||||
let within_one_cycle = b
|
let within_one_cycle = b
|
||||||
.f_ord_equal(
|
.f_sub(types.float, None, upper_cycle, lower_cycle)
|
||||||
types.bool,
|
.unwrap();
|
||||||
None,
|
let within_one_cycle = b
|
||||||
b.f_sub(types.float, None, upper_cycle, lower_cycle)
|
.f_ord_equal(types.bool, None, within_one_cycle, one)
|
||||||
.unwrap(),
|
|
||||||
one,
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let temp0 = b
|
let temp0 = b
|
||||||
.ext_inst(
|
.ext_inst(
|
||||||
@@ -1292,65 +1230,43 @@ pub(crate) fn compile_interval_function(
|
|||||||
[IdRef(val_a.1)],
|
[IdRef(val_a.1)],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
let lower_valid = b.f_ord_equal(types.bool, None, cycle, zero).unwrap();
|
||||||
let lower_valid = b
|
let lower_valid = b
|
||||||
.logical_or(
|
.logical_and(types.bool, None, within_one_cycle, lower_valid)
|
||||||
types.bool,
|
.unwrap();
|
||||||
None,
|
let lower_valid = b
|
||||||
same_cycle,
|
.logical_or(types.bool, None, same_cycle, lower_valid)
|
||||||
b.logical_and(
|
.unwrap();
|
||||||
types.bool,
|
let upper_valid = b.f_ord_equal(types.bool, None, cycle, one).unwrap();
|
||||||
None,
|
let upper_valid = b
|
||||||
within_one_cycle,
|
.logical_and(types.bool, None, within_one_cycle, upper_valid)
|
||||||
b.f_ord_equal(types.bool, None, cycle, zero).unwrap(),
|
|
||||||
)
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let upper_valid = b
|
let upper_valid = b
|
||||||
.logical_or(
|
.logical_or(types.bool, None, same_cycle, upper_valid)
|
||||||
types.bool,
|
|
||||||
None,
|
|
||||||
same_cycle,
|
|
||||||
b.logical_and(
|
|
||||||
types.bool,
|
|
||||||
None,
|
|
||||||
within_one_cycle,
|
|
||||||
b.f_ord_equal(types.bool, None, cycle, one).unwrap(),
|
|
||||||
)
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let lower = b
|
let lower = b
|
||||||
.select(
|
.ext_inst(
|
||||||
types.float,
|
|
||||||
None,
|
|
||||||
lower_valid,
|
|
||||||
b.ext_inst(
|
|
||||||
types.float,
|
types.float,
|
||||||
None,
|
None,
|
||||||
types.glsl,
|
types.glsl,
|
||||||
spirv::GLOp::FMin as u32,
|
spirv::GLOp::FMin as u32,
|
||||||
[IdRef(temp0), IdRef(temp1)],
|
[IdRef(temp0), IdRef(temp1)],
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap();
|
||||||
minus_one,
|
let lower = b
|
||||||
)
|
.select(types.float, None, lower_valid, lower, minus_one)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let upper = b
|
let upper = b
|
||||||
.select(
|
.ext_inst(
|
||||||
types.float,
|
|
||||||
None,
|
|
||||||
upper_valid,
|
|
||||||
b.ext_inst(
|
|
||||||
types.float,
|
types.float,
|
||||||
None,
|
None,
|
||||||
types.glsl,
|
types.glsl,
|
||||||
spirv::GLOp::FMax as u32,
|
spirv::GLOp::FMax as u32,
|
||||||
[IdRef(temp0), IdRef(temp1)],
|
[IdRef(temp0), IdRef(temp1)],
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap();
|
||||||
one,
|
let upper = b
|
||||||
)
|
.select(types.float, None, upper_valid, upper, one)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
(lower, upper)
|
(lower, upper)
|
||||||
});
|
});
|
||||||
@@ -1378,15 +1294,11 @@ pub(crate) fn compile_interval_function(
|
|||||||
[IdRef(val_a.1)],
|
[IdRef(val_a.1)],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let result_valid = b
|
let lt = b.f_ord_less_than(types.bool, None, size, pi).unwrap();
|
||||||
.logical_and(
|
let gte = b
|
||||||
types.bool,
|
.f_ord_greater_than_equal(types.bool, None, upper_tmp, lower_tmp)
|
||||||
None,
|
|
||||||
b.f_ord_less_than(types.bool, None, size, pi).unwrap(),
|
|
||||||
b.f_ord_greater_than_equal(types.bool, None, upper_tmp, lower_tmp)
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
let result_valid = b.logical_and(types.bool, None, lt, gte).unwrap();
|
||||||
(
|
(
|
||||||
b.select(types.float, None, result_valid, lower_tmp, nan)
|
b.select(types.float, None, result_valid, lower_tmp, nan)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
@@ -1418,16 +1330,13 @@ pub(crate) fn compile_interval_function(
|
|||||||
[IdRef(val_a.1)],
|
[IdRef(val_a.1)],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let result_valid = b
|
let gte = b
|
||||||
.logical_and(
|
.f_ord_greater_than_equal(types.bool, None, val_a.0, minus_one)
|
||||||
types.bool,
|
|
||||||
None,
|
|
||||||
b.f_ord_greater_than_equal(types.bool, None, val_a.0, minus_one)
|
|
||||||
.unwrap(),
|
|
||||||
b.f_ord_less_than_equal(types.bool, None, val_a.1, one)
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
let lte = b
|
||||||
|
.f_ord_less_than_equal(types.bool, None, val_a.1, one)
|
||||||
|
.unwrap();
|
||||||
|
let result_valid = b.logical_and(types.bool, None, gte, lte).unwrap();
|
||||||
(
|
(
|
||||||
b.select(types.float, None, result_valid, lower_tmp, nan)
|
b.select(types.float, None, result_valid, lower_tmp, nan)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
@@ -1459,16 +1368,13 @@ pub(crate) fn compile_interval_function(
|
|||||||
[IdRef(val_a.1)],
|
[IdRef(val_a.1)],
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let result_valid = b
|
let gte = b
|
||||||
.logical_and(
|
.f_ord_greater_than_equal(types.bool, None, val_a.0, minus_one)
|
||||||
types.bool,
|
|
||||||
None,
|
|
||||||
b.f_ord_greater_than_equal(types.bool, None, val_a.0, minus_one)
|
|
||||||
.unwrap(),
|
|
||||||
b.f_ord_less_than_equal(types.bool, None, val_a.1, one)
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
let lte = b
|
||||||
|
.f_ord_less_than_equal(types.bool, None, val_a.1, one)
|
||||||
|
.unwrap();
|
||||||
|
let result_valid = b.logical_and(types.bool, None, gte, lte).unwrap();
|
||||||
(
|
(
|
||||||
b.select(types.float, None, result_valid, lower_tmp, nan)
|
b.select(types.float, None, result_valid, lower_tmp, nan)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
@@ -1822,12 +1728,9 @@ pub(crate) fn compile_interval_function(
|
|||||||
let rad1 = input_resolve(types.float, b, &mapping, instruction.inputs[3 as usize]);
|
let rad1 = input_resolve(types.float, b, &mapping, instruction.inputs[3 as usize]);
|
||||||
let rad2 = input_resolve(types.float, b, &mapping, instruction.inputs[4 as usize]);
|
let rad2 = input_resolve(types.float, b, &mapping, instruction.inputs[4 as usize]);
|
||||||
|
|
||||||
let dot = add(
|
let squ1 = square(types.float, b, types.bool, types.glsl, pos_part[0]);
|
||||||
types.float,
|
let squ2 = square(types.float, b, types.bool, types.glsl, pos_part[2]);
|
||||||
b,
|
let dot = add(types.float, b, squ1, squ2);
|
||||||
square(types.float, b, types.bool, types.glsl, pos_part[0]),
|
|
||||||
square(types.float, b, types.bool, types.glsl, pos_part[2]),
|
|
||||||
);
|
|
||||||
let sqrt = (
|
let sqrt = (
|
||||||
b.ext_inst(
|
b.ext_inst(
|
||||||
types.float,
|
types.float,
|
||||||
|
|||||||
@@ -106,37 +106,6 @@ pub(crate) fn compile_point_function(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn param_four(
|
|
||||||
float: u32,
|
|
||||||
b: &mut rspirv::dr::Builder,
|
|
||||||
mapping: &mut HashMap<u32, u32>,
|
|
||||||
instruction: &SSAInstruction,
|
|
||||||
func: impl Fn(&mut rspirv::dr::Builder, u32, u32, u32, u32) -> u32,
|
|
||||||
) {
|
|
||||||
for i in 0..instruction.opcode.size as usize {
|
|
||||||
let val_a = input_resolve(float, b, &mapping, instruction.inputs[i]);
|
|
||||||
let val_b = input_resolve(
|
|
||||||
float,
|
|
||||||
b,
|
|
||||||
&mapping,
|
|
||||||
instruction.inputs[i + instruction.opcode.size as usize],
|
|
||||||
);
|
|
||||||
let val_c = input_resolve(
|
|
||||||
float,
|
|
||||||
b,
|
|
||||||
&mapping,
|
|
||||||
instruction.inputs[i + (instruction.opcode.size as usize * 2)],
|
|
||||||
);
|
|
||||||
let val_d = input_resolve(
|
|
||||||
float,
|
|
||||||
b,
|
|
||||||
&mapping,
|
|
||||||
instruction.inputs[i + (instruction.opcode.size as usize * 3)],
|
|
||||||
);
|
|
||||||
mapping.insert(instruction.outputs[i], func(b, val_a, val_b, val_c, val_d));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
match instruction.opcode.opcode {
|
match instruction.opcode.opcode {
|
||||||
SSAStop => {
|
SSAStop => {
|
||||||
let zero = b.constant_bit32(types.float, (0.0f32).to_bits());
|
let zero = b.constant_bit32(types.float, (0.0f32).to_bits());
|
||||||
|
|||||||
+8
-11
@@ -6,10 +6,7 @@ use crate::{
|
|||||||
DUMP_SPV_DIS_TO_FILE,
|
DUMP_SPV_DIS_TO_FILE,
|
||||||
instruction_set::InstructionSet,
|
instruction_set::InstructionSet,
|
||||||
spirv_compilers::{
|
spirv_compilers::{
|
||||||
SpirVTypes,
|
SpirVTypes, interval::compile_interval_function, point::compile_point_function,
|
||||||
//gradient::compile_gradient_function,
|
|
||||||
//interval::compile_interval_function,
|
|
||||||
point::compile_point_function,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -477,7 +474,7 @@ impl SSATape {
|
|||||||
let void = b.type_void();
|
let void = b.type_void();
|
||||||
let float = b.type_float(32);
|
let float = b.type_float(32);
|
||||||
let bool = b.type_bool();
|
let bool = b.type_bool();
|
||||||
let choice = b.type_int(2, 0);
|
let choice = b.type_int(8, 0);
|
||||||
let vec2 = b.type_vector(float, 2);
|
let vec2 = b.type_vector(float, 2);
|
||||||
let vec3 = b.type_vector(float, 3);
|
let vec3 = b.type_vector(float, 3);
|
||||||
let vec4 = b.type_vector(float, 4);
|
let vec4 = b.type_vector(float, 4);
|
||||||
@@ -508,12 +505,12 @@ impl SSATape {
|
|||||||
if with_module { Some(1000) } else { None },
|
if with_module { Some(1000) } else { None },
|
||||||
);
|
);
|
||||||
|
|
||||||
//compile_interval_function(
|
compile_interval_function(
|
||||||
// &mut b,
|
&mut b,
|
||||||
// &self,
|
&self,
|
||||||
// types,
|
types,
|
||||||
// if with_module { Some(2000) } else { None },
|
if with_module { Some(2000) } else { None },
|
||||||
//);
|
);
|
||||||
|
|
||||||
//compile_gradient_function(
|
//compile_gradient_function(
|
||||||
// &mut b,
|
// &mut b,
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ impl Grad {
|
|||||||
|
|
||||||
/// Checks that the two values are roughly equal, panicking otherwise
|
/// Checks that the two values are roughly equal, panicking otherwise
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
#[allow(unused)]
|
||||||
pub(crate) fn compare_eq(&self, other: Self) {
|
pub(crate) fn compare_eq(&self, other: Self) {
|
||||||
let d = (self.v - other.v)
|
let d = (self.v - other.v)
|
||||||
.abs()
|
.abs()
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ use std::simd::{
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
interpreters::{
|
interpreters::{
|
||||||
Mask, VALUE_0, VALUE_1, VALUE_2, VALUE_05, VALUE_M1, VALUE_NAN, VALUE_PI, VALUE_PI_2,
|
Mask, VALUE_0, VALUE_1, VALUE_2, VALUE_M1, VALUE_NAN, VALUE_PI, Value, glfract, glsign,
|
||||||
VALUE_TAU, Value, glfract, glsign,
|
|
||||||
},
|
},
|
||||||
vm::choice::{Choice, VChoice},
|
vm::choice::VChoice,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Stores a range, with conservative calculations to guarantee that it always
|
/// Stores a range, with conservative calculations to guarantee that it always
|
||||||
@@ -469,6 +468,7 @@ impl Interval {
|
|||||||
|
|
||||||
/// Checks that the two values are roughly equal, panicking otherwise
|
/// Checks that the two values are roughly equal, panicking otherwise
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
#[allow(unused)]
|
||||||
pub(crate) fn compare_eq(&self, other: Self) {
|
pub(crate) fn compare_eq(&self, other: Self) {
|
||||||
let d = (self.lower - other.lower)
|
let d = (self.lower - other.lower)
|
||||||
.abs()
|
.abs()
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
use std::simd::{
|
use std::simd::u32x8;
|
||||||
StdFloat,
|
|
||||||
cmp::{SimdPartialEq, SimdPartialOrd},
|
|
||||||
num::SimdFloat,
|
|
||||||
u32x8,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// A single choice made at a min/max node.
|
/// A single choice made at a min/max node.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user