Controlling anti-aliasing when rendering to surface that is not the same size as the window #6636
-
I'd like to be able to render to a lower resolution and display it in a pixelated fashion, with nearest neighbor interpolation. I have a resize function that configures the surface and sets up intermediate rendering targets. When I ignore the window size and use 32x32 pixels, it winds up being blurry. This is on MacOS. See below actual size pub(crate) fn resize(&mut self, size: PhysicalSize<u32>) {
self.config.width = size.width.max(1);
self.config.height = size.height.max(1);
self.surface.configure(&self.device, &self.config);
for target in self.targets.iter_mut() {
*target = Target::new(
&self.bind_group_layout,
&self.config,
&self.device,
&self.sampler,
self.texture_format,
&self.uniform_buffer,
);
}
} 32x32 pub(crate) fn resize(&mut self, size: PhysicalSize<u32>) {
self.config.width = 32;
self.config.height = 32;
self.surface.configure(&self.device, &self.config);
for target in self.targets.iter_mut() {
*target = Target::new(
&self.bind_group_layout,
&self.config,
&self.device,
&self.sampler,
self.texture_format,
&self.uniform_buffer,
);
}
} I looked at the Is this something that can be controlled from |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The expected flow is to render to a literal 32x32 image, then render that image yourself to the swapchain of normal size. Right now it's technically not defined the behavior if your swapchain is the wrong size. |
Beta Was this translation helpful? Give feedback.
The expected flow is to render to a literal 32x32 image, then render that image yourself to the swapchain of normal size.
Right now it's technically not defined the behavior if your swapchain is the wrong size.