mirror of
https://github.com/enso-org/enso.git
synced 2024-12-19 12:12:09 +03:00
Fix drawing instance with empty buffers (https://github.com/enso-org/ide/pull/292)
This code was developed as a fix for occuring "crashes" on Windows,
which were in fact a "contextLost" events of WebGl.
Original commit: 92b95df814
This commit is contained in:
parent
1b573988a7
commit
4af19c5745
@ -270,12 +270,14 @@ impl {
|
||||
let first = 0;
|
||||
let count = self.surface.point_scope().size() as i32;
|
||||
let instance_count = self.surface.instance_scope().size() as i32;
|
||||
let instance_count = std::cmp::max(instance_count,1);
|
||||
|
||||
self.stats.inc_draw_call_count();
|
||||
if instance_count > 0 {
|
||||
self.context.draw_arrays_instanced(mode,first,count,instance_count);
|
||||
} else {
|
||||
self.context.draw_arrays(mode,first,count);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
}}
|
||||
|
@ -90,6 +90,7 @@ impl<T:Storable> {
|
||||
stats.inc_buffer_count();
|
||||
let mut_dirty = MutDirty::new(logger.sub("mut_dirty"),Callback(on_mut));
|
||||
let resize_dirty = ResizeDirty::new(logger.sub("resize_dirty"),Callback(on_resize));
|
||||
resize_dirty.set();
|
||||
let on_resize_fn = on_resize_fn(resize_dirty.clone_ref());
|
||||
let on_mut_fn = on_mut_fn(mut_dirty.clone_ref());
|
||||
let buffer = ObservableVec::new(on_mut_fn,on_resize_fn);
|
||||
|
Loading…
Reference in New Issue
Block a user