Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renderer: Fix border profiling. #3032

Merged
merged 1 commit into from Sep 7, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

renderer: Fix border profiling.

Was broken by #3011.

Also while at it, avoid setting and unsetting blend modes unnecessarily.
  • Loading branch information
emilio committed Sep 7, 2018
commit 7a0887e239c5d3a5298e479381240eba753a9f80
@@ -3399,46 +3399,42 @@ impl Renderer {

// Draw any borders for this target.
if !target.border_segments_solid.is_empty() ||
!target.border_segments_complex.is_empty() {
!target.border_segments_complex.is_empty()
{
let _timer = self.gpu_profile.start_timer(GPU_TAG_CACHE_BORDER);
}

if !target.border_segments_solid.is_empty() {
self.set_blend(true, FramebufferKind::Other);
self.set_blend_mode_premultiplied_alpha(FramebufferKind::Other);

self.shaders.cs_border_solid.bind(
&mut self.device,
&projection,
&mut self.renderer_errors,
);

self.draw_instanced_batch(
&target.border_segments_solid,
VertexArrayKind::Border,
&BatchTextures::no_texture(),
stats,
);

self.set_blend(false, FramebufferKind::Other);
}
if !target.border_segments_solid.is_empty() {
self.shaders.cs_border_solid.bind(
&mut self.device,
&projection,
&mut self.renderer_errors,
);

if !target.border_segments_complex.is_empty() {
self.set_blend(true, FramebufferKind::Other);
self.set_blend_mode_premultiplied_alpha(FramebufferKind::Other);
self.draw_instanced_batch(
&target.border_segments_solid,
VertexArrayKind::Border,
&BatchTextures::no_texture(),
stats,
);
}

self.shaders.cs_border_segment.bind(
&mut self.device,
&projection,
&mut self.renderer_errors,
);
if !target.border_segments_complex.is_empty() {
self.shaders.cs_border_segment.bind(
&mut self.device,
&projection,
&mut self.renderer_errors,
);

self.draw_instanced_batch(
&target.border_segments_complex,
VertexArrayKind::Border,
&BatchTextures::no_texture(),
stats,
);
self.draw_instanced_batch(
&target.border_segments_complex,
VertexArrayKind::Border,
&BatchTextures::no_texture(),
stats,
);
}

self.set_blend(false, FramebufferKind::Other);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.