Apply texture deltas even when skipping frames
Since the renderer rework, texture updates and frees were dropped whenever a frame was skipped. Apply deltas before acquiring the surface texture and free textures on skipped or lost surfaces.
This commit is contained in:
1 parent
01697e32bd
commit
4316366f87
2 files changed
+17
-5
No files matched your search
+2
-1
@@ -5,6 +5,7 @@
|
||||
### Fixed
|
||||
|
||||
- Fix blurry text inside viewports with fractional scale factors
|
||||
- Fix crash on macOS
|
||||
|
||||
## [0.3.3] - 2026-10-23
|
||||
|
||||
@@ -256,8 +257,8 @@
|
||||
- First release
|
||||
|
||||
<!-- next-url -->
|
||||
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.3.3...HEAD
|
||||
|
||||
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.3.3...HEAD
|
||||
[0.3.3]: https://github.com/meehl/rusty-path-of-building/compare/v0.3.2...v0.3.3
|
||||
[0.3.2]: https://github.com/meehl/rusty-path-of-building/compare/v0.3.1...v0.3.2
|
||||
[0.3.1]: https://github.com/meehl/rusty-path-of-building/compare/v0.3.0...v0.3.1
|
||||
|
||||
+15
-4
@@ -174,7 +174,16 @@ impl GraphicsContext {
|
||||
pub fn render(&mut self, render_job: Option<RenderJob>) -> anyhow::Result<()> {
|
||||
profiling::scope!("render");
|
||||
|
||||
// apply textures delta
|
||||
if let Some(render_job) = &render_job {
|
||||
self.renderer
|
||||
.update_textures(&self.device, &self.queue, &render_job.textures_delta);
|
||||
}
|
||||
|
||||
if !self.is_surface_configured {
|
||||
if let Some(render_job) = &render_job {
|
||||
self.renderer.free_textures(&render_job.textures_delta);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -185,10 +194,16 @@ impl GraphicsContext {
|
||||
| wgpu::CurrentSurfaceTexture::Occluded
|
||||
| wgpu::CurrentSurfaceTexture::Validation => {
|
||||
// Skip frame
|
||||
if let Some(render_job) = &render_job {
|
||||
self.renderer.free_textures(&render_job.textures_delta);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
wgpu::CurrentSurfaceTexture::Outdated | wgpu::CurrentSurfaceTexture::Lost => {
|
||||
self.surface.configure(&self.device, &self.config);
|
||||
if let Some(render_job) = &render_job {
|
||||
self.renderer.free_textures(&render_job.textures_delta);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
@@ -208,10 +223,6 @@ impl GraphicsContext {
|
||||
if let Some(render_job) = render_job {
|
||||
let screen_size = PhysicalSize::new(self.config.width, self.config.height);
|
||||
|
||||
// upload new textures
|
||||
self.renderer
|
||||
.update_textures(&self.device, &self.queue, &render_job.textures_delta);
|
||||
|
||||
// upload vertex, index, and uniform buffers
|
||||
self.renderer.update_buffers(
|
||||
&self.device,
|
||||
|
||||
Reference in new issue
Block a user