fix directory
This commit is contained in:
+2
-1
@@ -9,7 +9,8 @@ import re
|
||||
SHADERS_DIR = "shaders_out"
|
||||
TARGET_ENV = "vulkan1.3"
|
||||
|
||||
shutil.rmtree(SHADERS_DIR)
|
||||
if os.path.isdir(SHADERS_DIR):
|
||||
shutil.rmtree(SHADERS_DIR)
|
||||
os.mkdir(SHADERS_DIR)
|
||||
|
||||
normal_shaders = [
|
||||
|
||||
+64
-65
@@ -1,4 +1,3 @@
|
||||
#![feature(variant_count)]
|
||||
#![feature(portable_simd)]
|
||||
#![feature(mpmc_channel)]
|
||||
|
||||
@@ -156,18 +155,18 @@ struct Keys {
|
||||
|
||||
struct CState {
|
||||
position: Vec3,
|
||||
forward: Vec3,
|
||||
looking: bool,
|
||||
keys: Keys,
|
||||
forward: Vec3,
|
||||
looking: bool,
|
||||
keys: Keys,
|
||||
}
|
||||
|
||||
impl Default for CState {
|
||||
fn default() -> Self {
|
||||
CState {
|
||||
position: vec3(0., 0., 3.),
|
||||
forward: vec3(0., 0., 0.),
|
||||
looking: false,
|
||||
keys: Keys {
|
||||
forward: vec3(0., 0., 0.),
|
||||
looking: false,
|
||||
keys: Keys {
|
||||
w: false,
|
||||
s: false,
|
||||
a: false,
|
||||
@@ -234,12 +233,12 @@ struct App {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct ShaderModules {
|
||||
trace_vs: Arc<ShaderModule>,
|
||||
trace_vs: Arc<ShaderModule>,
|
||||
fullscreen_vs: Arc<ShaderModule>,
|
||||
lighting_fs: Arc<ShaderModule>,
|
||||
raygen: Arc<ShaderModule>,
|
||||
closest_hit: Arc<ShaderModule>,
|
||||
miss: Arc<ShaderModule>,
|
||||
lighting_fs: Arc<ShaderModule>,
|
||||
raygen: Arc<ShaderModule>,
|
||||
closest_hit: Arc<ShaderModule>,
|
||||
miss: Arc<ShaderModule>,
|
||||
}
|
||||
|
||||
struct RenderContext {
|
||||
@@ -560,10 +559,10 @@ impl App {
|
||||
notify::EventKind::Modify(notify::event::ModifyKind::Data(_)) => {
|
||||
info!("event: {:?}", event);
|
||||
watcher_glsl_changed.store(true, std::sync::atomic::Ordering::SeqCst);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
},
|
||||
}
|
||||
Err(e) => error!("watch error: {:?}", e),
|
||||
},
|
||||
)
|
||||
@@ -823,12 +822,12 @@ impl ApplicationHandler for App {
|
||||
.map(|load| load(self.device.clone()).unwrap());
|
||||
|
||||
let shader_modules = ShaderModules {
|
||||
trace_vs: pariter.next().unwrap(),
|
||||
trace_vs: pariter.next().unwrap(),
|
||||
fullscreen_vs: pariter.next().unwrap(),
|
||||
lighting_fs: pariter.next().unwrap(),
|
||||
raygen: pariter.next().unwrap(),
|
||||
closest_hit: pariter.next().unwrap(),
|
||||
miss: pariter.next().unwrap(),
|
||||
lighting_fs: pariter.next().unwrap(),
|
||||
raygen: pariter.next().unwrap(),
|
||||
closest_hit: pariter.next().unwrap(),
|
||||
miss: pariter.next().unwrap(),
|
||||
};
|
||||
|
||||
drop(pariter);
|
||||
@@ -892,8 +891,8 @@ impl ApplicationHandler for App {
|
||||
.unwrap();
|
||||
|
||||
let viewport = Viewport {
|
||||
offset: [0.0, window_size.height as f32],
|
||||
extent: [window_size.width as f32, window_size.height as f32 * -1.],
|
||||
offset: [0.0, window_size.height as f32],
|
||||
extent: [window_size.width as f32, window_size.height as f32 * -1.],
|
||||
depth_range: 0.0..=1.0,
|
||||
};
|
||||
|
||||
@@ -959,8 +958,8 @@ impl ApplicationHandler for App {
|
||||
images[0].format(),
|
||||
GuiConfig {
|
||||
allow_srgb_render_target: true,
|
||||
is_overlay: true,
|
||||
samples: SampleCount::Sample1,
|
||||
is_overlay: true,
|
||||
samples: SampleCount::Sample1,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1025,16 +1024,16 @@ impl ApplicationHandler for App {
|
||||
match &event {
|
||||
WindowEvent::CloseRequested => {
|
||||
event_loop.exit();
|
||||
},
|
||||
}
|
||||
WindowEvent::Resized(_) => {
|
||||
rcx.recreate_swapchain = true;
|
||||
},
|
||||
}
|
||||
WindowEvent::ScaleFactorChanged { .. } => {
|
||||
rcx.recreate_swapchain = true;
|
||||
},
|
||||
}
|
||||
WindowEvent::DroppedFile(_file) => {
|
||||
todo!()
|
||||
},
|
||||
}
|
||||
WindowEvent::MouseInput {
|
||||
device_id: d,
|
||||
state: s,
|
||||
@@ -1045,7 +1044,7 @@ impl ApplicationHandler for App {
|
||||
if b == &MouseButton::Right {
|
||||
self.cstate.looking = s == &ElementState::Pressed;
|
||||
}
|
||||
},
|
||||
}
|
||||
WindowEvent::KeyboardInput {
|
||||
device_id: _,
|
||||
event: input,
|
||||
@@ -1053,19 +1052,19 @@ impl ApplicationHandler for App {
|
||||
} => match input.physical_key {
|
||||
PhysicalKey::Code(KeyCode::KeyW) => {
|
||||
self.cstate.keys.w = input.state == ElementState::Pressed;
|
||||
},
|
||||
}
|
||||
PhysicalKey::Code(KeyCode::KeyS) => {
|
||||
self.cstate.keys.s = input.state == ElementState::Pressed;
|
||||
},
|
||||
}
|
||||
PhysicalKey::Code(KeyCode::KeyA) => {
|
||||
self.cstate.keys.a = input.state == ElementState::Pressed;
|
||||
},
|
||||
}
|
||||
PhysicalKey::Code(KeyCode::KeyD) => {
|
||||
self.cstate.keys.d = input.state == ElementState::Pressed;
|
||||
},
|
||||
}
|
||||
PhysicalKey::Code(KeyCode::ShiftLeft) => {
|
||||
self.cstate.looking = input.state == ElementState::Pressed;
|
||||
},
|
||||
}
|
||||
PhysicalKey::Code(KeyCode::Space) => {
|
||||
if input.state == ElementState::Pressed {
|
||||
self.thread_work_creation
|
||||
@@ -1087,18 +1086,18 @@ impl ApplicationHandler for App {
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
},
|
||||
}
|
||||
PhysicalKey::Code(KeyCode::KeyG) => {
|
||||
if input.state == ElementState::Pressed {
|
||||
self.draw_gui = !self.draw_gui;
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
WindowEvent::RedrawRequested => {
|
||||
self.redraw(rcx);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1169,23 +1168,23 @@ impl App {
|
||||
* Mat4::from_translation(Vec3::ZERO - self.cstate.position);
|
||||
|
||||
let uniform_data = trace_vs::Camera {
|
||||
proj_view: (proj * view).to_cols_array_2d(),
|
||||
inv_proj_view: (proj * view).inverse().to_cols_array_2d(),
|
||||
inv_proj: (proj).inverse().to_cols_array_2d(),
|
||||
inv_view: (view).inverse().to_cols_array_2d(),
|
||||
campos_and_time: [
|
||||
proj_view: (proj * view).to_cols_array_2d(),
|
||||
inv_proj_view: (proj * view).inverse().to_cols_array_2d(),
|
||||
inv_proj: (proj).inverse().to_cols_array_2d(),
|
||||
inv_view: (view).inverse().to_cols_array_2d(),
|
||||
campos_and_time: [
|
||||
self.cstate.position.x,
|
||||
self.cstate.position.y,
|
||||
self.cstate.position.z,
|
||||
self.time,
|
||||
],
|
||||
specular: self.gstate.specular.into(),
|
||||
specular_tint: self.gstate.specular_tint.into(),
|
||||
sheen_tint: self.gstate.sheen_tint.into(),
|
||||
sheen: self.gstate.sheen.into(),
|
||||
specular: self.gstate.specular.into(),
|
||||
specular_tint: self.gstate.specular_tint.into(),
|
||||
sheen_tint: self.gstate.sheen_tint.into(),
|
||||
sheen: self.gstate.sheen.into(),
|
||||
clear_coat_gloss: self.gstate.clear_coat_gloss.into(),
|
||||
subsurface: self.gstate.subsurface.into(),
|
||||
clear_coat: self.gstate.clear_coat.into(),
|
||||
subsurface: self.gstate.subsurface.into(),
|
||||
clear_coat: self.gstate.clear_coat.into(),
|
||||
};
|
||||
|
||||
if self.cstate.looking {
|
||||
@@ -1537,9 +1536,9 @@ impl App {
|
||||
} else {
|
||||
self.gstate.csg[index as usize] = csg;
|
||||
}
|
||||
},
|
||||
WorkComplete::GetPushConstants(..) => {},
|
||||
WorkComplete::RecompilePipelines(..) => {},
|
||||
}
|
||||
WorkComplete::GetPushConstants(..) => {}
|
||||
WorkComplete::RecompilePipelines(..) => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1706,7 +1705,7 @@ impl App {
|
||||
match work {
|
||||
WorkComplete::RecompilePipelines(_index) => {
|
||||
csg_left -= 1;
|
||||
},
|
||||
}
|
||||
other => work_for_later.push(other),
|
||||
}
|
||||
}
|
||||
@@ -1781,7 +1780,7 @@ impl App {
|
||||
|
||||
let mut push_constants = vec![
|
||||
PushConstantData {
|
||||
world: Default::default(),
|
||||
world: Default::default(),
|
||||
inv_world: Default::default(),
|
||||
};
|
||||
self.gstate.csg.len()
|
||||
@@ -1858,7 +1857,7 @@ impl App {
|
||||
match work {
|
||||
WorkComplete::RecompilePipelines(_index) => {
|
||||
csg_left -= 1;
|
||||
},
|
||||
}
|
||||
other => work_for_later.push(other),
|
||||
}
|
||||
}
|
||||
@@ -1873,7 +1872,7 @@ impl App {
|
||||
Err(VulkanError::OutOfDate) => {
|
||||
rcx.recreate_swapchain = true;
|
||||
return;
|
||||
},
|
||||
}
|
||||
Err(e) => panic!("Failed to acquire next image: {e}"),
|
||||
};
|
||||
|
||||
@@ -1976,7 +1975,7 @@ impl App {
|
||||
Some(future.boxed())
|
||||
};
|
||||
push_constants_left -= 1;
|
||||
},
|
||||
}
|
||||
other => work_for_later.push(other),
|
||||
}
|
||||
}
|
||||
@@ -2051,20 +2050,20 @@ impl App {
|
||||
match future.map_err(Validated::unwrap) {
|
||||
Ok(future) => {
|
||||
rcx.previous_frame_end[image_index] = Some(future);
|
||||
},
|
||||
}
|
||||
Err(VulkanError::OutOfDate) => {
|
||||
rcx.recreate_swapchain = true;
|
||||
rcx.previous_frame_end[image_index] = None;
|
||||
},
|
||||
}
|
||||
Err(e) => {
|
||||
error!("Failed to flush future: {e:?}");
|
||||
rcx.previous_frame_end[image_index] = None;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
for work in self.thread_work_completion.try_iter() {
|
||||
match work {
|
||||
WorkComplete::GetPushConstants(..) => {},
|
||||
WorkComplete::GetPushConstants(..) => {}
|
||||
other => work_for_later.push(other),
|
||||
}
|
||||
}
|
||||
@@ -2110,8 +2109,8 @@ fn framebuffer_generation(
|
||||
depth_buffer.clone(),
|
||||
ImageViewCreateInfo {
|
||||
subresource_range: ImageSubresourceRange {
|
||||
aspects: ImageAspects::DEPTH,
|
||||
mip_levels: 0..1,
|
||||
aspects: ImageAspects::DEPTH,
|
||||
mip_levels: 0..1,
|
||||
array_layers: 0..1,
|
||||
},
|
||||
..ImageViewCreateInfo::from_image(&depth_buffer.clone())
|
||||
@@ -2407,7 +2406,7 @@ fn pipeline_recompile(
|
||||
RayTracingShaderGroupCreateInfo::General { general_shader: 1 },
|
||||
RayTracingShaderGroupCreateInfo::TrianglesHit {
|
||||
closest_hit_shader: Some(2),
|
||||
any_hit_shader: None,
|
||||
any_hit_shader: None,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user