浏览代码

Move glClear call out of the critical path

Johannes Hofmann 7 年前
父节点
当前提交
e4e11e76cd
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 5
    0
      src/main.rs
  2. 0
    2
      src/map_view_gl.rs

+ 5
- 0
src/main.rs 查看文件

@@ -292,6 +292,11 @@ fn main() {
292 292
 
293 293
             let _ = gl_window.swap_buffers();
294 294
 
295
+            // Move glClear call out of the critical path.
296
+            //TODO do not call glClear when drawing fills the whole screen anyway
297
+            cx.clear_color((0.2, 0.2, 0.2, 1.0));
298
+
299
+
295 300
             //TODO increase atlas size earlier to avoid excessive copying to the GPU
296 301
             //TODO increase max tile cache size?
297 302
             increase_atlas_size = {

+ 0
- 2
src/map_view_gl.rs 查看文件

@@ -103,8 +103,6 @@ impl<'a> MapViewGl<'a> {
103 103
             center: self.map_view.center,
104 104
         });
105 105
 
106
-        self.cx.clear_color((0.2, 0.2, 0.2, 1.0));
107
-
108 106
         let visible_tiles = self.map_view.visible_tiles(true);
109 107
         let mut remainder = visible_tiles.as_slice();
110 108
         let mut num_draws = 0;