Issue draw calls only when necessary

This commit is contained in:
Héctor Ramón Jiménez 2019-10-29 01:21:28 +01:00
parent 2b23e0986c
commit 23ebfb707a

View file

@ -294,6 +294,7 @@ impl Renderer {
let translated = transformation let translated = transformation
* Transformation::translate(0.0, -(layer.y_offset as f32)); * Transformation::translate(0.0, -(layer.y_offset as f32));
if layer.quads.len() > 0 {
self.quad_pipeline.draw( self.quad_pipeline.draw(
&mut self.device, &mut self.device,
encoder, encoder,
@ -302,7 +303,9 @@ impl Renderer {
layer.bounds, layer.bounds,
target, target,
); );
}
if layer.images.len() > 0 {
self.image_pipeline.draw( self.image_pipeline.draw(
&mut self.device, &mut self.device,
encoder, encoder,
@ -311,8 +314,9 @@ impl Renderer {
layer.bounds, layer.bounds,
target, target,
); );
}
{ if layer.text.len() > 0 {
let mut glyph_brush = self.glyph_brush.borrow_mut(); let mut glyph_brush = self.glyph_brush.borrow_mut();
for text in layer.text.iter() { for text in layer.text.iter() {