• R/O
  • SSH

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision2e93909f5f2bf6f242da4777d4a068d7a8627ca6 (tree)
l'heure2020-07-10 14:10:33
AuteurMartin Krošlák <kroslakma@gmai...>
CommiterMartin Krošlák

Message de Log

Fix unhandled swapchain suboptimal results

Change Summary

Modification

diff -r f18e438f7bde -r 2e93909f5f2b code/mel/gal/src/lib.rs
--- a/code/mel/gal/src/lib.rs Tue Jun 30 21:06:27 2020 +0200
+++ b/code/mel/gal/src/lib.rs Fri Jul 10 07:10:33 2020 +0200
@@ -65,6 +65,7 @@
6565 state: StateBuffer,
6666
6767 index_count: u32,
68+ recreate_flipchain: bool,
6869
6970 mem_sys: MemorySystem,
7071 init_provider: InitProvider,
diff -r f18e438f7bde -r 2e93909f5f2b code/mel/gal/src/misc.rs
--- a/code/mel/gal/src/misc.rs Tue Jun 30 21:06:27 2020 +0200
+++ b/code/mel/gal/src/misc.rs Fri Jul 10 07:10:33 2020 +0200
@@ -142,6 +142,7 @@
142142 state: StateBuffer::default(),
143143
144144 index_count: ib_data.len() as u32,
145+ recreate_flipchain: false,
145146
146147 mem_sys,
147148 init_provider,
@@ -199,7 +200,7 @@
199200 let (flipchain, acquire_result) = match acquire_result {
200201 Ok(idx) => (self.flipchain.as_mut().unwrap(), Ok(idx)),
201202 Err(vk::Result::ERROR_OUT_OF_DATE_KHR) => {
202- on_window_size_changed(
203+ recreate_flipchain(
203204 &self.device,
204205 &self.surface,
205206 &mut self.flipchain,
@@ -208,6 +209,7 @@
208209 &self.shaders,
209210 &self.init_provider,
210211 );
212+ self.recreate_flipchain = false;
211213
212214 match self.flipchain {
213215 Some(ref mut flipchain) => {
@@ -229,7 +231,10 @@
229231 Err(result) => panic!("Unexpected result of next image acquire: {:?}", result),
230232 };
231233
232- let (flipchain_frame_idx, _is_suboptimal) = acquire_result.unwrap();
234+ let (flipchain_frame_idx, is_suboptimal) = acquire_result.unwrap();
235+ if is_suboptimal {
236+ self.recreate_flipchain = true;
237+ }
233238
234239 let vframe = &mut self.virtual_frames[virtual_frame_idx];
235240 vframe.begin_cb_graphics(
@@ -272,8 +277,17 @@
272277 };
273278
274279 match present_result {
275- Ok(_is_suboptimal) => (),
276- Err(vk::Result::ERROR_OUT_OF_DATE_KHR) => on_window_size_changed(
280+ Ok(is_suboptimal) => {
281+ if is_suboptimal {
282+ self.recreate_flipchain = true;
283+ }
284+ }
285+ Err(vk::Result::ERROR_OUT_OF_DATE_KHR) => self.recreate_flipchain = true,
286+ Err(result) => panic!("Unexpected result of present: {:?}", result),
287+ };
288+
289+ if self.recreate_flipchain {
290+ recreate_flipchain(
277291 &self.device,
278292 &self.surface,
279293 &mut self.flipchain,
@@ -281,9 +295,9 @@
281295 &mut self.render_pass,
282296 &self.shaders,
283297 &self.init_provider,
284- ),
285- Err(result) => panic!("Unexpected result of present: {:?}", result),
286- };
298+ );
299+ self.recreate_flipchain = false;
300+ }
287301 }
288302
289303 fn begin_2d_rendering(
@@ -524,7 +538,7 @@
524538 }
525539 }
526540
527-fn on_window_size_changed(
541+fn recreate_flipchain(
528542 device: &api::Device,
529543 surface: &api::SurfaceKHR,
530544 flipchain: &mut Option<Flipchain>,
diff -r f18e438f7bde -r 2e93909f5f2b run.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/run.sh Fri Jul 10 07:10:33 2020 +0200
@@ -0,0 +1,6 @@
1+#!/bin/bash
2+set -e
3+cargo build --workspace
4+export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
5+export MEL_MODULE_PATH_BASE=target/debug
6+gdb -q target/debug/game