From 5cf005467680bc204b89ffc659de755e5eda323d Mon Sep 17 00:00:00 2001 From: John Wells Date: Tue, 16 Jul 2024 22:30:22 -0400 Subject: [PATCH] Remove unwanted code --- src/driver/graphic.rs | 16 ++-------------- src/driver/shader.rs | 2 +- src/graph/resolver.rs | 14 ++------------ 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/driver/graphic.rs b/src/driver/graphic.rs index d91e536..9c9f603 100644 --- a/src/driver/graphic.rs +++ b/src/driver/graphic.rs @@ -5,11 +5,8 @@ use { device::Device, image::SampleCount, merge_push_constant_ranges, - shader::{ - DescriptorBindingMap, DescriptorInfo, PipelineDescriptorInfo, Shader, - SpecializationInfo, - }, - DescriptorBinding, DriverError, + shader::{DescriptorBindingMap, PipelineDescriptorInfo, Shader, SpecializationInfo}, + DriverError, }, ash::vk, derive_builder::{Builder, UninitializedFieldError}, @@ -366,7 +363,6 @@ pub struct GraphicPipeline { pub name: Option, pub(crate) push_constants: Vec, - pub(crate) separate_samplers: Box<[DescriptorBinding]>, pub(crate) shader_modules: Vec, pub(super) state: GraphicPipelineState, } @@ -463,13 +459,6 @@ impl GraphicPipeline { } } - let separate_samplers = descriptor_bindings - .iter() - .filter_map(|(&descriptor_binding, (descriptor_info, _))| { - matches!(descriptor_info, DescriptorInfo::Sampler(..)).then_some(descriptor_binding) - }) - .collect(); - let descriptor_info = PipelineDescriptorInfo::create(&device, &descriptor_bindings)?; let descriptor_sets_layouts = descriptor_info .layouts @@ -571,7 +560,6 @@ impl GraphicPipeline { layout, name: None, push_constants, - separate_samplers, shader_modules, state: GraphicPipelineState { layout, diff --git a/src/driver/shader.rs b/src/driver/shader.rs index dc99f20..7c29ae3 100644 --- a/src/driver/shader.rs +++ b/src/driver/shader.rs @@ -144,7 +144,7 @@ impl DescriptorInfo { } } - pub fn sampler(&self) -> Option<&Sampler> { + fn sampler(&self) -> Option<&Sampler> { match self { Self::CombinedImageSampler(_, sampler, _) | Self::Sampler(_, sampler, _) => { Some(sampler) diff --git a/src/graph/resolver.rs b/src/graph/resolver.rs index 70ae53c..3809dd6 100644 --- a/src/graph/resolver.rs +++ b/src/graph/resolver.rs @@ -2846,7 +2846,6 @@ impl Resolver { image_view_info.aspect_mask = format_aspect_mask(image.info.fmt); } - let sampler = descriptor_info.sampler().map(|sampler| **sampler).unwrap_or_default(); let image_view = Image::view(image, image_view_info)?; let image_layout = match descriptor_type { vk::DescriptorType::COMBINED_IMAGE_SAMPLER | vk::DescriptorType::SAMPLED_IMAGE => { @@ -2891,7 +2890,7 @@ impl Resolver { tls.image_infos.push(vk::DescriptorImageInfo { image_layout, image_view, - sampler, + sampler: vk::Sampler::null(), }); } else if let Some(buffer) = bound_node.as_driver_buffer() { let view_info = view_info.as_ref().unwrap(); @@ -2941,14 +2940,6 @@ impl Resolver { } if let ExecutionPipeline::Graphic(pipeline) = pipeline { - for descriptor_binding in pipeline.separate_samplers.iter().copied() { - tls.image_infos.push(vk::DescriptorImageInfo { - image_layout: Default::default(), - image_view: Default::default(), - sampler: **pipeline.descriptor_bindings[&descriptor_binding].0.sampler().unwrap(), - }); - } - // Write graphic render pass input attachments (they're automatic) if exec_idx > 0 { for (&DescriptorBinding(descriptor_set_idx, dst_binding), (descriptor_info, _)) in @@ -2989,7 +2980,6 @@ impl Resolver { ty: image.info.ty, }; let image_view = Image::view(image, image_view_info)?; - let sampler = descriptor_info.sampler().map(|sampler| **sampler).unwrap_or_else(vk::Sampler::null); tls.image_writes.push(IndexWrite { idx: tls.image_infos.len(), @@ -3010,7 +3000,7 @@ impl Resolver { true, ), image_view, - sampler, + sampler: vk::Sampler::null(), }); } }