fmt clippy

This commit is contained in:
2025-12-26 00:50:30 +00:00
parent 18fdec939c
commit ee0e0c2b5f
7 changed files with 76 additions and 88 deletions
Generated
+25 -25
View File
@@ -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",
] ]
+2 -3
View File
@@ -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
View File
@@ -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");
@@ -2660,7 +2654,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> {
+7 -12
View File
@@ -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(),
@@ -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();
} }
+1
View File
@@ -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),
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -474,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);