remove msaa

This commit is contained in:
2025-06-29 21:24:25 +01:00
parent 1b6c93f781
commit 33d8a95eea
+29 -104
View File
@@ -3,8 +3,6 @@
#![feature(portable_simd)]
const DYNAMIC_STATE: bool = true;
const MSAA_ENABLE: bool = false;
const MSAA_SAMPLES: u32 = 4;
const SAMPLE_RATE_SHADING: Option<f32> = None; //1.0;
const DUMP_SPV_TO_FILE: bool = false;
@@ -50,7 +48,7 @@ use vulkano::{
QueueCreateInfo, QueueFlags, physical::PhysicalDeviceType,
},
format::Format,
image::{Image, ImageCreateInfo, ImageType, ImageUsage, view::ImageView},
image::{Image, ImageCreateInfo, ImageType, ImageUsage, SampleCount, view::ImageView},
instance::{Instance, InstanceCreateInfo, InstanceExtensions},
memory::allocator::{
AllocationCreateInfo, MemoryAllocatePreference, MemoryTypeFilter, StandardMemoryAllocator,
@@ -102,8 +100,6 @@ use crate::interpreter::{IntervalInterpreter, PointInterpreter, VALUE_0};
mod types;
mod vm;
const MSAA_SAMPLES_ACTUAL: u32 = if MSAA_ENABLE { MSAA_SAMPLES } else { 1 };
fn main() -> Result<(), impl Error> {
CombinedLogger::init(vec![
TermLogger::new(
@@ -734,68 +730,32 @@ impl ApplicationHandler for App {
drop(pariter);
let render_pass = if MSAA_ENABLE {
vulkano::ordered_passes_renderpass!(
self.device.clone(),
attachments: {
intermediary: {
format: swapchain.image_format(),
samples: MSAA_SAMPLES_ACTUAL,
load_op: Clear,
store_op: DontCare,
},
color: {
format: swapchain.image_format(),
samples: 1,
load_op: DontCare,
store_op: Store,
},
multi_depth: {
format: Format::D16_UNORM,
samples: MSAA_SAMPLES_ACTUAL,
load_op: Clear,
store_op: DontCare,
},
let render_pass = vulkano::ordered_passes_renderpass!(
self.device.clone(),
attachments: {
color: {
format: swapchain.image_format(),
samples: 1,
load_op: Clear,
store_op: Store,
},
passes: [{
color: [intermediary],
color_resolve: [color],
depth_stencil: {multi_depth},
input: [],
},{
color: [color],
depth_stencil: {},
input: [],
}]
)
} else {
vulkano::ordered_passes_renderpass!(
self.device.clone(),
attachments: {
color: {
format: swapchain.image_format(),
samples: 1,
load_op: Clear,
store_op: Store,
},
depth: {
format: Format::D16_UNORM,
samples: 1,
load_op: Clear,
store_op: DontCare,
},
depth: {
format: Format::D16_UNORM,
samples: 1,
load_op: Clear,
store_op: DontCare,
},
passes: [{
color: [color],
depth_stencil: {depth},
input: [],
},{
color: [color],
depth_stencil: {},
input: [],
}]
)
}
},
passes: [{
color: [color],
depth_stencil: {depth},
input: [],
},{
color: [color],
depth_stencil: {},
input: [],
}]
)
.unwrap();
let viewport = Viewport {
@@ -826,7 +786,7 @@ impl ApplicationHandler for App {
GuiConfig {
allow_srgb_render_target: true,
is_overlay: true,
samples: MSAA_SAMPLES_ACTUAL.try_into().unwrap(),
samples: SampleCount::Sample1,
},
);
@@ -1201,11 +1161,7 @@ impl App {
builder
.begin_render_pass(
RenderPassBeginInfo {
clear_values: if MSAA_ENABLE {
vec![Some([0.12, 0.1, 0.1, 1.0].into()), None, Some(1.0.into())]
} else {
vec![Some([0.12, 0.1, 0.1, 1.0].into()), Some(1.0.into())]
},
clear_values: vec![Some([0.12, 0.1, 0.1, 1.0].into()), Some(1.0.into())],
..RenderPassBeginInfo::framebuffer(
rcx.framebuffers[image_index as usize].clone(),
)
@@ -1321,7 +1277,6 @@ fn framebuffer_generation(
format: Format::D16_UNORM,
extent: images[0].extent(),
usage: ImageUsage::DEPTH_STENCIL_ATTACHMENT | ImageUsage::TRANSIENT_ATTACHMENT,
samples: MSAA_SAMPLES_ACTUAL.try_into().unwrap(),
..Default::default()
},
AllocationCreateInfo::default(),
@@ -1330,29 +1285,6 @@ fn framebuffer_generation(
)
.unwrap();
let intermediary = if MSAA_ENABLE {
Some(
ImageView::new_default(
Image::new(
allocator.clone(),
ImageCreateInfo {
image_type: ImageType::Dim2d,
format: images[0].format(),
extent: images[0].extent(),
usage: ImageUsage::COLOR_ATTACHMENT | ImageUsage::TRANSIENT_ATTACHMENT,
samples: MSAA_SAMPLES_ACTUAL.try_into().unwrap(),
..Default::default()
},
AllocationCreateInfo::default(),
)
.unwrap(),
)
.unwrap(),
)
} else {
None
};
let framebuffers = images
.iter()
.map(|image| {
@@ -1361,15 +1293,8 @@ fn framebuffer_generation(
Framebuffer::new(
render_pass.clone(),
FramebufferCreateInfo {
attachments: if MSAA_ENABLE {
vec![
intermediary.as_ref().unwrap().clone(),
view,
depth_buffer.clone(),
]
} else {
vec![view, depth_buffer.clone()]
},
attachments: vec![view, depth_buffer.clone()],
..Default::default()
},
)