Hoist uniforms out of the draw list loop

This commit is contained in:
Joonas Javanainen 2016-03-26 18:44:06 +02:00
parent 69e9dd1537
commit 83b949b1ad

View File

@ -88,19 +88,19 @@ impl Renderer {
try!(self.device_objects.upload_index_buffer(&self.ctx, draw_list.idx_buffer));
let (width, height) = surface.get_dimensions();
let matrix = [
[ 2.0 / (width as f32), 0.0, 0.0, 0.0 ],
[ 0.0, 2.0 / -(height as f32), 0.0, 0.0 ],
[ 0.0, 0.0, -1.0, 0.0 ],
[ -1.0, 1.0, 0.0, 1.0 ]
];
let uniforms = uniform! {
matrix: matrix,
tex: &self.device_objects.texture
};
let mut idx_start = 0;
for cmd in draw_list.cmd_buffer {
let matrix = [
[ 2.0 / (width as f32), 0.0, 0.0, 0.0 ],
[ 0.0, 2.0 / -(height as f32), 0.0, 0.0 ],
[ 0.0, 0.0, -1.0, 0.0 ],
[ -1.0, 1.0, 0.0, 1.0 ]
];
let uniforms = uniform! {
matrix: matrix,
tex: &self.device_objects.texture
};
let draw_params = DrawParameters {
blend: Blend::alpha_blending(),
scissor: Some(Rect {