Add multiple material process

This commit is contained in:
2025-07-03 22:53:04 +01:00
parent 57b40fd694
commit 7d95303062
3 changed files with 18 additions and 11 deletions
Generated
+4 -4
View File
@@ -1105,9 +1105,9 @@ checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
[[package]] [[package]]
name = "libfuzzer-sys" name = "libfuzzer-sys"
version = "0.4.9" version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf78f52d400cf2d84a3a973a78a592b4adc535739e0a5597a0da6f0c357adc75" checksum = "5037190e1f70cbeef565bd267599242926f724d3b8a9f510fd7e0b540cfa4404"
dependencies = [ dependencies = [
"arbitrary", "arbitrary",
"cc", "cc",
@@ -3473,9 +3473,9 @@ dependencies = [
[[package]] [[package]]
name = "zune-jpeg" name = "zune-jpeg"
version = "0.4.18" version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7384255a918371b5af158218d131530f694de9ad3815ebdd0453a940485cb0fa" checksum = "2c9e525af0a6a658e031e95f14b7f889976b74a11ba0eca5a5fc9ac8a1c43a6a"
dependencies = [ dependencies = [
"zune-core", "zune-core",
] ]
+13 -6
View File
@@ -214,7 +214,7 @@ struct RenderContext {
render_pass: Arc<RenderPass>, render_pass: Arc<RenderPass>,
framebuffers: Vec<Arc<Framebuffer>>, framebuffers: Vec<Arc<Framebuffer>>,
color_buffer: Arc<ImageView>, color_buffer: Arc<ImageView>,
material: Arc<ImageView>, material_buffer: Arc<ImageView>,
normal_buffer: Arc<ImageView>, normal_buffer: Arc<ImageView>,
depth_buffer: Arc<ImageView>, depth_buffer: Arc<ImageView>,
shader_modules: ShaderModules, shader_modules: ShaderModules,
@@ -840,7 +840,7 @@ impl ApplicationHandler for App {
depth_range: 0.0..=1.0, depth_range: 0.0..=1.0,
}; };
let (framebuffers, color_buffer, material, normal_buffer, depth_buffer) = let (framebuffers, color_buffer, material_buffer, normal_buffer, depth_buffer) =
framebuffer_generation(&images, &render_pass, &self.memory_allocator); framebuffer_generation(&images, &render_pass, &self.memory_allocator);
let lighting_pipeline = pipeline_recompile( let lighting_pipeline = pipeline_recompile(
@@ -873,7 +873,7 @@ impl ApplicationHandler for App {
render_pass, render_pass,
framebuffers, framebuffers,
color_buffer, color_buffer,
material, material_buffer,
normal_buffer, normal_buffer,
depth_buffer, depth_buffer,
shader_modules, shader_modules,
@@ -1043,7 +1043,7 @@ impl App {
( (
rcx.framebuffers, rcx.framebuffers,
rcx.color_buffer, rcx.color_buffer,
rcx.material, rcx.material_buffer,
rcx.normal_buffer, rcx.normal_buffer,
rcx.depth_buffer, rcx.depth_buffer,
) = framebuffer_generation(&new_images, &rcx.render_pass, &self.memory_allocator); ) = framebuffer_generation(&new_images, &rcx.render_pass, &self.memory_allocator);
@@ -1266,7 +1266,10 @@ impl App {
let normals_set = DescriptorSet::new( let normals_set = DescriptorSet::new(
self.descriptor_set_allocator.clone(), self.descriptor_set_allocator.clone(),
normals_layout.clone(), normals_layout.clone(),
[WriteDescriptorSet::image_view(0, rcx.depth_buffer.clone())], [
WriteDescriptorSet::image_view(0, rcx.material_buffer.clone()),
WriteDescriptorSet::image_view(1, rcx.depth_buffer.clone()),
],
[], [],
) )
.unwrap(); .unwrap();
@@ -1336,7 +1339,7 @@ impl App {
RenderPassBeginInfo { RenderPassBeginInfo {
clear_values: vec![ clear_values: vec![
Some([0.0, 0.0, 0.0, 1.0].into()), Some([0.0, 0.0, 0.0, 1.0].into()),
Some(ClearValue::Uint([0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF])), Some(ClearValue::Uint([0, 0, 0, 0])),
Some([0.12, 0.1, 0.1, 1.0].into()), Some([0.12, 0.1, 0.1, 1.0].into()),
Some([0.0, 0.0, 0.0, 1.0].into()), Some([0.0, 0.0, 0.0, 1.0].into()),
Some(1.0.into()), Some(1.0.into()),
@@ -1384,6 +1387,8 @@ impl App {
interval_check(csg, &mut push_constants); interval_check(csg, &mut push_constants);
push_constants.material = i as _;
builder builder
.push_constants( .push_constants(
rcx.implicit_pipelines[i].layout().clone(), rcx.implicit_pipelines[i].layout().clone(),
@@ -1429,6 +1434,8 @@ impl App {
* Mat4::from_scale(csg.scale * 2.0)) * Mat4::from_scale(csg.scale * 2.0))
.to_cols_array_2d(); .to_cols_array_2d();
push_constants.material = i as _;
builder builder
.push_constants(rcx.normals_pipelines[i].layout().clone(), 0, push_constants) .push_constants(rcx.normals_pipelines[i].layout().clone(), 0, push_constants)
.unwrap(); .unwrap();
+1 -1
View File
@@ -6,7 +6,7 @@
layout(location = 0) in vec2 v_pos; layout(location = 0) in vec2 v_pos;
layout(input_attachment_index = 0, set = 1, binding = 0) uniform subpassInput u_material; layout(input_attachment_index = 0, set = 1, binding = 0) uniform usubpassInput u_material;
layout(input_attachment_index = 1, set = 1, binding = 1) uniform subpassInput u_depth; layout(input_attachment_index = 1, set = 1, binding = 1) uniform subpassInput u_depth;
layout(location = 0) out vec4 f_color; layout(location = 0) out vec4 f_color;