Skip to content

Commit

Permalink
Remove unwanted code
Browse files Browse the repository at this point in the history
  • Loading branch information
attackgoat committed Jul 17, 2024
1 parent 8f2b35e commit 5cf0054
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
16 changes: 2 additions & 14 deletions src/driver/graphic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -366,7 +363,6 @@ pub struct GraphicPipeline {
pub name: Option<String>,

pub(crate) push_constants: Vec<vk::PushConstantRange>,
pub(crate) separate_samplers: Box<[DescriptorBinding]>,
pub(crate) shader_modules: Vec<vk::ShaderModule>,
pub(super) state: GraphicPipelineState,
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -571,7 +560,6 @@ impl GraphicPipeline {
layout,
name: None,
push_constants,
separate_samplers,
shader_modules,
state: GraphicPipelineState {
layout,
Expand Down
2 changes: 1 addition & 1 deletion src/driver/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 2 additions & 12 deletions src/graph/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(),
Expand All @@ -3010,7 +3000,7 @@ impl Resolver {
true,
),
image_view,
sampler,
sampler: vk::Sampler::null(),
});
}
}
Expand Down

0 comments on commit 5cf0054

Please sign in to comment.