Bug 1521920 - Remove conditional compilation around debug_renderer. r=emilio
authorBobby Holley <bobbyholley@gmail.com>
Tue, 22 Jan 2019 21:29:24 +0000
changeset 514888 9e84fa9a6b9cdf42a80ec004511e3c6708f929c1
parent 514887 e997bd12da48d4029ff13af0ba0b7c338676189c
child 514889 69c9fbe4dd38e65a231a683dbd8471f813b54dfe
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1521920
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1521920 - Remove conditional compilation around debug_renderer. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D17284
gfx/wr/examples/Cargo.toml
gfx/wr/webrender/Cargo.toml
gfx/wr/webrender/src/device/gl.rs
gfx/wr/webrender/src/device/query_gl.rs
gfx/wr/webrender/src/frame_builder.rs
gfx/wr/webrender/src/lib.rs
gfx/wr/webrender/src/picture.rs
gfx/wr/webrender/src/prim_store/mod.rs
gfx/wr/webrender/src/profiler.rs
gfx/wr/webrender/src/renderer.rs
gfx/wr/webrender/src/tiling.rs
--- a/gfx/wr/examples/Cargo.toml
+++ b/gfx/wr/examples/Cargo.toml
@@ -49,17 +49,17 @@ path = "scrolling.rs"
 name = "texture_cache_stress"
 path = "texture_cache_stress.rs"
 
 [[bin]]
 name = "yuv"
 path = "yuv.rs"
 
 [features]
-debug = ["webrender/capture", "webrender/debugger", "webrender/profiler", "webrender/debug_renderer"]
+debug = ["webrender/capture", "webrender/debugger", "webrender/profiler"]
 
 [dependencies]
 app_units = "0.7"
 env_logger = "0.5"
 euclid = "0.19"
 gleam = "0.6.2"
 glutin = "0.17"
 rayon = "1"
--- a/gfx/wr/webrender/Cargo.toml
+++ b/gfx/wr/webrender/Cargo.toml
@@ -5,21 +5,20 @@ authors = ["Glenn Watson <gw@intuitionli
 license = "MPL-2.0"
 repository = "https://github.com/servo/webrender"
 description = "A GPU accelerated 2D renderer for web content"
 build = "build.rs"
 
 [features]
 default = ["freetype-lib"]
 freetype-lib = ["freetype/servo-freetype-sys"]
-profiler = ["thread_profiler/thread_profiler", "debug_renderer"]
-debugger = ["ws", "serde_json", "serde", "image", "base64", "debug_renderer"]
-capture = ["webrender_api/serialize", "ron", "serde", "debug_renderer"]
+profiler = ["thread_profiler/thread_profiler"]
+debugger = ["ws", "serde_json", "serde", "image", "base64"]
+capture = ["webrender_api/serialize", "ron", "serde"]
 replay = ["webrender_api/deserialize", "ron", "serde"]
-debug_renderer = []
 pathfinder = ["pathfinder_font_renderer", "pathfinder_gfx_utils", "pathfinder_partitioner", "pathfinder_path_utils"]
 serialize_program = ["serde", "webrender_build/serialize_program"]
 no_static_freetype = []
 
 [build-dependencies]
 webrender_build = { version = "0.0.1", path = "../webrender_build" }
 
 [dependencies]
--- a/gfx/wr/webrender/src/device/gl.rs
+++ b/gfx/wr/webrender/src/device/gl.rs
@@ -2,17 +2,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use super::super::shader_source::SHADERS;
 use api::{ColorF, ImageFormat, MemoryReport};
 use api::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
 use api::TextureTarget;
 use api::VoidPtrToSizeFn;
-#[cfg(any(feature = "debug_renderer", feature="capture"))]
 use api::ImageDescriptor;
 use euclid::Transform3D;
 use gleam::gl;
 use internal_types::{FastHashMap, LayerIndex, RenderTargetInfo};
 use log::Level;
 use sha2::{Digest, Sha256};
 use smallvec::SmallVec;
 use std::borrow::Cow;
@@ -85,17 +84,16 @@ const SHADER_KIND_FRAGMENT: &str = "#def
 
 pub struct TextureSlot(pub usize);
 
 // In some places we need to temporarily bind a texture to any slot.
 const DEFAULT_TEXTURE: TextureSlot = TextureSlot(0);
 
 #[repr(u32)]
 pub enum DepthFunction {
-    #[cfg(feature = "debug_renderer")]
     Less = gl::LESS,
     LessEqual = gl::LEQUAL,
 }
 
 #[repr(u32)]
 #[derive(Copy, Clone, Debug, PartialEq)]
 #[cfg_attr(feature = "capture", derive(Serialize))]
 #[cfg_attr(feature = "replay", derive(Deserialize))]
@@ -103,17 +101,16 @@ pub enum TextureFilter {
     Nearest,
     Linear,
     Trilinear,
 }
 
 #[derive(Debug)]
 pub enum VertexAttributeKind {
     F32,
-    #[cfg(feature = "debug_renderer")]
     U8Norm,
     U16Norm,
     I32,
     U16,
 }
 
 #[derive(Debug)]
 pub struct VertexAttribute {
@@ -279,17 +276,16 @@ fn build_shader_main_string<F: FnMut(&st
 pub trait FileWatcherHandler: Send {
     fn file_changed(&self, path: PathBuf);
 }
 
 impl VertexAttributeKind {
     fn size_in_bytes(&self) -> u32 {
         match *self {
             VertexAttributeKind::F32 => 4,
-            #[cfg(feature = "debug_renderer")]
             VertexAttributeKind::U8Norm => 1,
             VertexAttributeKind::U16Norm => 2,
             VertexAttributeKind::I32 => 4,
             VertexAttributeKind::U16 => 2,
         }
     }
 }
 
@@ -315,17 +311,16 @@ impl VertexAttribute {
                     attr_index,
                     self.count as gl::GLint,
                     gl::FLOAT,
                     false,
                     stride,
                     offset,
                 );
             }
-            #[cfg(feature = "debug_renderer")]
             VertexAttributeKind::U8Norm => {
                 gl.vertex_attrib_pointer(
                     attr_index,
                     self.count as gl::GLint,
                     gl::UNSIGNED_BYTE,
                     true,
                     stride,
                     offset,
@@ -537,17 +532,16 @@ impl Texture {
     pub fn get_layer_count(&self) -> i32 {
         self.layer_count
     }
 
     pub fn get_format(&self) -> ImageFormat {
         self.format
     }
 
-    #[cfg(any(feature = "debug_renderer", feature = "capture"))]
     pub fn get_filter(&self) -> TextureFilter {
         self.filter
     }
 
     pub fn supports_depth(&self) -> bool {
         !self.fbos_with_depth.is_empty()
     }
 
@@ -874,17 +868,16 @@ impl VertexUsageHint {
 
 #[derive(Copy, Clone, Debug)]
 pub struct UniformLocation(gl::GLint);
 
 impl UniformLocation {
     pub const INVALID: Self = UniformLocation(-1);
 }
 
-#[cfg(feature = "debug_renderer")]
 pub struct Capabilities {
     pub supports_multisampling: bool,
 }
 
 #[derive(Clone, Debug)]
 pub enum ShaderError {
     Compilation(String, String), // name, error message
     Link(String, String),        // name, error message
@@ -930,17 +923,16 @@ pub struct Device {
     /// Track depth state for assertions. Note that the default FBO has depth,
     /// so this defaults to true.
     depth_available: bool,
 
     device_pixel_ratio: f32,
     upload_method: UploadMethod,
 
     // HW or API capabilities
-    #[cfg(feature = "debug_renderer")]
     capabilities: Capabilities,
 
     bgra_format_internal: gl::GLuint,
     bgra_format_external: gl::GLuint,
 
     /// Map from texture dimensions to shared depth buffers for render targets.
     ///
     /// Render targets often have the same width/height, so we can save memory
@@ -1185,17 +1177,16 @@ impl Device {
             gl,
             resource_override_path,
             // This is initialized to 1 by default, but it is reset
             // at the beginning of each frame in `Renderer::bind_frame_data`.
             device_pixel_ratio: 1.0,
             upload_method,
             inside_frame: false,
 
-            #[cfg(feature = "debug_renderer")]
             capabilities: Capabilities {
                 supports_multisampling: false, //TODO
             },
 
             bgra_format_internal,
             bgra_format_external,
 
             depth_targets: FastHashMap::default(),
@@ -1250,17 +1241,16 @@ impl Device {
         self.max_texture_size
     }
 
     /// Returns the limit on texture array layers.
     pub fn max_texture_layers(&self) -> usize {
         self.max_texture_layers as usize
     }
 
-    #[cfg(feature = "debug_renderer")]
     pub fn get_capabilities(&self) -> &Capabilities {
         &self.capabilities
     }
 
     pub fn reset_state(&mut self) {
         self.bound_textures = [0; 16];
         self.bound_vao = 0;
         self.bound_read_fbo = FBOId(0);
@@ -2102,17 +2092,16 @@ impl Device {
             if u_location != -1 {
                 self.bind_program(program);
                 self.gl
                     .uniform_1i(u_location, binding.1.into().0 as gl::GLint);
             }
         }
     }
 
-    #[cfg(feature = "debug_renderer")]
     pub fn get_uniform_location(&self, program: &Program, name: &str) -> UniformLocation {
         UniformLocation(self.gl.get_uniform_location(program.id, name))
     }
 
     pub fn set_uniforms(
         &self,
         program: &Program,
         transform: &Transform3D<f32>,
@@ -2208,17 +2197,16 @@ impl Device {
                     desc.external,
                     desc.pixel_type,
                     texels_to_u8_slice(pixels),
                 ),
             _ => panic!("BUG: Unexpected texture target!"),
         }
     }
 
-    #[cfg(any(feature = "debug_renderer", feature = "capture"))]
     pub fn read_pixels(&mut self, img_desc: &ImageDescriptor) -> Vec<u8> {
         let desc = self.gl_describe_format(img_desc.format);
         self.gl.read_pixels(
             0, 0,
             img_desc.size.width as i32,
             img_desc.size.height as i32,
             desc.external,
             desc.pixel_type,
@@ -2255,17 +2243,16 @@ impl Device {
             rect.size.height as _,
             desc.external,
             desc.pixel_type,
             output,
         );
     }
 
     /// Get texels of a texture into the specified output slice.
-    #[cfg(feature = "debug_renderer")]
     pub fn get_tex_image_into(
         &mut self,
         texture: &Texture,
         format: ImageFormat,
         output: &mut [u8],
     ) {
         self.bind_texture(DEFAULT_TEXTURE, texture);
         let desc = self.gl_describe_format(format);
@@ -2274,17 +2261,16 @@ impl Device {
             0,
             desc.external,
             desc.pixel_type,
             output,
         );
     }
 
     /// Attaches the provided texture to the current Read FBO binding.
-    #[cfg(any(feature = "debug_renderer", feature="capture"))]
     fn attach_read_texture_raw(
         &mut self, texture_id: gl::GLuint, target: gl::GLuint, layer_id: i32
     ) {
         match target {
             gl::TEXTURE_2D_ARRAY => {
                 self.gl.framebuffer_texture_layer(
                     gl::READ_FRAMEBUFFER,
                     gl::COLOR_ATTACHMENT0,
@@ -2301,24 +2287,22 @@ impl Device {
                     target,
                     texture_id,
                     0,
                 )
             }
         }
     }
 
-    #[cfg(any(feature = "debug_renderer", feature="capture"))]
     pub fn attach_read_texture_external(
         &mut self, texture_id: gl::GLuint, target: TextureTarget, layer_id: i32
     ) {
         self.attach_read_texture_raw(texture_id, get_gl_target(target), layer_id)
     }
 
-    #[cfg(any(feature = "debug_renderer", feature="capture"))]
     pub fn attach_read_texture(&mut self, texture: &Texture, layer_id: i32) {
         self.attach_read_texture_raw(texture.id, texture.target, layer_id)
     }
 
     fn bind_vao_impl(&mut self, id: gl::GLuint) {
         debug_assert!(self.inside_frame);
 
         if self.bound_vao != id {
@@ -2544,33 +2528,31 @@ impl Device {
         self.gl.draw_elements(
             gl::TRIANGLES,
             index_count,
             gl::UNSIGNED_SHORT,
             first_vertex as u32 * 2,
         );
     }
 
-    #[cfg(feature = "debug_renderer")]
     pub fn draw_triangles_u32(&mut self, first_vertex: i32, index_count: i32) {
         debug_assert!(self.inside_frame);
         self.gl.draw_elements(
             gl::TRIANGLES,
             index_count,
             gl::UNSIGNED_INT,
             first_vertex as u32 * 4,
         );
     }
 
     pub fn draw_nonindexed_points(&mut self, first_vertex: i32, vertex_count: i32) {
         debug_assert!(self.inside_frame);
         self.gl.draw_arrays(gl::POINTS, first_vertex, vertex_count);
     }
 
-    #[cfg(feature = "debug_renderer")]
     pub fn draw_nonindexed_lines(&mut self, first_vertex: i32, vertex_count: i32) {
         debug_assert!(self.inside_frame);
         self.gl.draw_arrays(gl::LINES, first_vertex, vertex_count);
     }
 
     pub fn draw_indexed_triangles_instanced_u16(&mut self, index_count: i32, instance_count: i32) {
         debug_assert!(self.inside_frame);
         self.gl.draw_elements_instanced(
@@ -2728,17 +2710,16 @@ impl Device {
             .blend_func_separate(gl::ZERO, gl::SRC_COLOR, gl::ZERO, gl::SRC_ALPHA);
         self.gl.blend_equation(gl::FUNC_ADD);
     }
     pub fn set_blend_mode_max(&self) {
         self.gl
             .blend_func_separate(gl::ONE, gl::ONE, gl::ONE, gl::ONE);
         self.gl.blend_equation_separate(gl::MAX, gl::FUNC_ADD);
     }
-    #[cfg(feature = "debug_renderer")]
     pub fn set_blend_mode_min(&self) {
         self.gl
             .blend_func_separate(gl::ONE, gl::ONE, gl::ONE, gl::ONE);
         self.gl.blend_equation_separate(gl::MIN, gl::FUNC_ADD);
     }
     pub fn set_blend_mode_subpixel_pass0(&self) {
         self.gl.blend_func(gl::ZERO, gl::ONE_MINUS_SRC_COLOR);
         self.gl.blend_equation(gl::FUNC_ADD);
--- a/gfx/wr/webrender/src/device/query_gl.rs
+++ b/gfx/wr/webrender/src/device/query_gl.rs
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use gleam::gl;
-#[cfg(feature = "debug_renderer")]
 use std::mem;
 use std::rc::Rc;
 
 use device::GpuFrameId;
 
 
 pub trait NamedTag {
     fn get_label(&self) -> &str;
@@ -50,17 +49,16 @@ impl<T> QuerySet<T> {
         assert_eq!(self.pending, 0);
         self.set.get(self.data.len()).cloned().map(|query_id| {
             self.data.push(value);
             self.pending = query_id;
             query_id
         })
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn take<F: Fn(&mut T, gl::GLuint)>(&mut self, fun: F) -> Vec<T> {
         let mut data = mem::replace(&mut self.data, Vec::new());
         for (value, &query) in data.iter_mut().zip(self.set.iter()) {
             fun(value, query)
         }
         data
     }
 }
@@ -156,17 +154,16 @@ impl<T: NamedTag> GpuFrameProfile<T> {
 
         if let Some(query) = self.samplers.add(GpuSampler { tag, count: 0 }) {
             self.gl.begin_query(gl::SAMPLES_PASSED, query);
         }
 
         GpuSampleQuery
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn build_samples(&mut self) -> (GpuFrameId, Vec<GpuTimer<T>>, Vec<GpuSampler<T>>) {
         debug_assert!(!self.inside_frame);
         let gl = &self.gl;
 
         (
             self.frame_id,
             self.timers.take(|timer, query| {
                 timer.time_ns = gl.get_query_object_ui64v(query, gl::QUERY_RESULT)
@@ -235,17 +232,16 @@ impl<T> GpuProfiler<T> {
     pub fn disable_samplers(&mut self) {
         for frame in &mut self.frames {
             frame.disable_samplers();
         }
     }
 }
 
 impl<T: NamedTag> GpuProfiler<T> {
-    #[cfg(feature = "debug_renderer")]
     pub fn build_samples(&mut self) -> (GpuFrameId, Vec<GpuTimer<T>>, Vec<GpuSampler<T>>) {
         self.frames[self.next_frame].build_samples()
     }
 
     pub fn begin_frame(&mut self, frame_id: GpuFrameId) {
         self.frames[self.next_frame].begin_frame(frame_id);
     }
 
--- a/gfx/wr/webrender/src/frame_builder.rs
+++ b/gfx/wr/webrender/src/frame_builder.rs
@@ -585,17 +585,16 @@ impl FrameBuilder {
             passes,
             transform_palette: transform_palette.transforms,
             render_tasks,
             deferred_resolves,
             gpu_cache_frame_id,
             has_been_rendered: false,
             has_texture_cache_tasks,
             prim_headers,
-            #[cfg(feature = "debug_renderer")]
             debug_items: mem::replace(&mut scratch.debug_items, Vec::new()),
         }
     }
 
     pub fn create_hit_tester(
         &mut self,
         clip_scroll_tree: &ClipScrollTree,
         clip_data_store: &ClipDataStore,
--- a/gfx/wr/webrender/src/lib.rs
+++ b/gfx/wr/webrender/src/lib.rs
@@ -73,19 +73,17 @@ use wr_malloc_size_of as malloc_size_of;
 mod batch;
 mod border;
 mod box_shadow;
 #[cfg(any(feature = "capture", feature = "replay"))]
 mod capture;
 mod clip;
 mod clip_scroll_tree;
 mod debug_colors;
-#[cfg(feature = "debug_renderer")]
 mod debug_font_data;
-#[cfg(feature = "debug_renderer")]
 mod debug_render;
 #[cfg(feature = "debugger")]
 mod debug_server;
 mod device;
 mod display_list_flattener;
 mod ellipse;
 mod frame_builder;
 mod freelist;
--- a/gfx/wr/webrender/src/picture.rs
+++ b/gfx/wr/webrender/src/picture.rs
@@ -1,22 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use api::{DeviceRect, FilterOp, MixBlendMode, PipelineId, PremultipliedColorF, PictureRect, PicturePoint, WorldPoint};
 use api::{DeviceIntRect, DevicePoint, LayoutRect, PictureToRasterTransform, LayoutPixel, PropertyBinding, PropertyBindingId};
 use api::{DevicePixelScale, RasterRect, RasterSpace, ColorF, ImageKey, DirtyRect, WorldSize, ClipMode, LayoutSize};
 use api::{PicturePixel, RasterPixel, WorldPixel, WorldRect, ImageFormat, ImageDescriptor, WorldVector2D, LayoutPoint};
-#[cfg(feature = "debug_renderer")]
 use api::{DebugFlags, DeviceVector2D};
 use box_shadow::{BLUR_SAMPLE_SCALE};
 use clip::{ClipStore, ClipChainId, ClipChainNode, ClipItem};
 use clip_scroll_tree::{ROOT_SPATIAL_NODE_INDEX, ClipScrollTree, SpatialNodeIndex, CoordinateSystemId};
-#[cfg(feature = "debug_renderer")]
 use debug_colors;
 use device::TextureFilter;
 use euclid::{TypedScale, vec3, TypedRect, TypedPoint2D, TypedSize2D};
 use euclid::approxeq::ApproxEq;
 use frame_builder::{FrameVisibilityContext, FrameVisibilityState};
 use intern::ItemUid;
 use internal_types::{FastHashMap, FastHashSet, PlaneSplitter};
 use frame_builder::{FrameBuildingContext, FrameBuildingState, PictureState, PictureContext};
@@ -1377,47 +1375,41 @@ impl TileCache {
             }
 
             // Decide how to handle this tile when drawing this frame.
             if tile.is_valid {
                 // No need to include this is any dirty rect calculations.
                 tile.consider_for_dirty_rect = false;
                 self.tiles_to_draw.push(TileIndex(i));
 
-                #[cfg(feature = "debug_renderer")]
-                {
-                    if frame_context.debug_flags.contains(DebugFlags::PICTURE_CACHING_DBG) {
-                        let tile_device_rect = tile.world_rect * frame_context.device_pixel_scale;
-                        let mut label_pos = tile_device_rect.origin + DeviceVector2D::new(20.0, 30.0);
-                        _scratch.push_debug_rect(
-                            tile_device_rect,
-                            debug_colors::GREEN,
-                        );
-                        _scratch.push_debug_string(
-                            label_pos,
-                            debug_colors::RED,
-                            format!("{:?} {:?} {:?}", tile.id, tile.handle, tile.world_rect),
-                        );
-                        label_pos.y += 20.0;
-                        _scratch.push_debug_string(
-                            label_pos,
-                            debug_colors::RED,
-                            format!("same: {} frames", tile.same_frames),
-                        );
-                    }
+                if frame_context.debug_flags.contains(DebugFlags::PICTURE_CACHING_DBG) {
+                    let tile_device_rect = tile.world_rect * frame_context.device_pixel_scale;
+                    let mut label_pos = tile_device_rect.origin + DeviceVector2D::new(20.0, 30.0);
+                    _scratch.push_debug_rect(
+                        tile_device_rect,
+                        debug_colors::GREEN,
+                    );
+                    _scratch.push_debug_string(
+                        label_pos,
+                        debug_colors::RED,
+                        format!("{:?} {:?} {:?}", tile.id, tile.handle, tile.world_rect),
+                    );
+                    label_pos.y += 20.0;
+                    _scratch.push_debug_string(
+                        label_pos,
+                        debug_colors::RED,
+                        format!("same: {} frames", tile.same_frames),
+                    );
                 }
             } else {
-                #[cfg(feature = "debug_renderer")]
-                {
-                    if frame_context.debug_flags.contains(DebugFlags::PICTURE_CACHING_DBG) {
-                        _scratch.push_debug_rect(
-                            visible_rect * frame_context.device_pixel_scale,
-                            debug_colors::RED,
-                        );
-                    }
+                if frame_context.debug_flags.contains(DebugFlags::PICTURE_CACHING_DBG) {
+                    _scratch.push_debug_rect(
+                        visible_rect * frame_context.device_pixel_scale,
+                        debug_colors::RED,
+                    );
                 }
 
                 // Only cache tiles that have had the same content for at least two
                 // frames. This skips caching on pages / benchmarks that are changing
                 // every frame, which is wasteful.
                 if tile.same_frames > FRAMES_BEFORE_CACHING {
                     // Ensure that this texture is allocated.
                     resource_cache.texture_cache.update(
--- a/gfx/wr/webrender/src/prim_store/mod.rs
+++ b/gfx/wr/webrender/src/prim_store/mod.rs
@@ -5,26 +5,23 @@
 use api::{BorderRadius, ClipMode, ColorF, PictureRect, ColorU, LayoutVector2D};
 use api::{DeviceIntRect, DevicePixelScale, DeviceRect, WorldVector2D};
 use api::{FilterOp, ImageRendering, TileOffset, RepeatMode, WorldPoint, WorldSize};
 use api::{LayoutPoint, LayoutRect, LayoutSideOffsets, LayoutSize};
 use api::{PremultipliedColorF, PropertyBinding, Shadow};
 use api::{WorldPixel, BoxShadowClipMode, WorldRect, LayoutToWorldScale};
 use api::{PicturePixel, RasterPixel, LineStyle, LineOrientation, AuHelpers};
 use api::{LayoutPrimitiveInfo};
-#[cfg(feature = "debug_renderer")]
 use api::DevicePoint;
 use border::{get_max_scale_for_border, build_border_instances};
 use border::BorderSegmentCacheKey;
 use clip::{ClipStore};
 use clip_scroll_tree::{ClipScrollTree, SpatialNodeIndex, ROOT_SPATIAL_NODE_INDEX};
 use clip::{ClipDataStore, ClipNodeFlags, ClipChainId, ClipChainInstance, ClipItem};
-#[cfg(feature = "debug_renderer")]
 use debug_colors;
-#[cfg(feature = "debug_renderer")]
 use debug_render::DebugItem;
 use display_list_flattener::{AsInstanceKind, CreateShadow, IsVisible};
 use euclid::{SideOffsets2D, TypedTransform3D, TypedRect, TypedScale, TypedSize2D};
 use frame_builder::{FrameBuildingContext, FrameBuildingState, PictureContext, PictureState};
 use frame_builder::{PrimitiveContext, FrameVisibilityContext, FrameVisibilityState};
 use glyph_rasterizer::GlyphKey;
 use gpu_cache::{GpuCache, GpuCacheAddress, GpuCacheHandle, GpuDataRequest, ToGpuBlocks};
 use gpu_types::BrushFlags;
@@ -1550,44 +1547,41 @@ pub struct PrimitiveScratchBuffer {
 
     /// A list of visible tiles that tiled gradients use to store
     /// per-tile information.
     pub gradient_tiles: GradientTileStorage,
 
     /// List of the visibility information for currently visible primitives.
     pub prim_info: Vec<PrimitiveVisibility>,
 
-    #[cfg(feature = "debug_renderer")]
     pub debug_items: Vec<DebugItem>,
 }
 
 impl PrimitiveScratchBuffer {
     pub fn new() -> Self {
         PrimitiveScratchBuffer {
             clip_mask_instances: Vec::new(),
             glyph_keys: GlyphKeyStorage::new(0),
             border_cache_handles: BorderHandleStorage::new(0),
             segments: SegmentStorage::new(0),
             segment_instances: SegmentInstanceStorage::new(0),
             gradient_tiles: GradientTileStorage::new(0),
-            #[cfg(feature = "debug_renderer")]
             debug_items: Vec::new(),
             prim_info: Vec::new(),
         }
     }
 
     pub fn recycle(&mut self, recycler: &mut Recycler) {
         recycler.recycle_vec(&mut self.clip_mask_instances);
         recycler.recycle_vec(&mut self.prim_info);
         self.glyph_keys.recycle(recycler);
         self.border_cache_handles.recycle(recycler);
         self.segments.recycle(recycler);
         self.segment_instances.recycle(recycler);
         self.gradient_tiles.recycle(recycler);
-        #[cfg(feature = "debug_renderer")]
         recycler.recycle_vec(&mut self.debug_items);
     }
 
     pub fn begin_frame(&mut self) {
         // Clear the clip mask tasks for the beginning of the frame. Append
         // a single kind representing no clip mask, at the ClipTaskIndex::INVALID
         // location.
         self.clip_mask_instances.clear();
@@ -1598,35 +1592,32 @@ impl PrimitiveScratchBuffer {
         // TODO(gw): As in the previous code, the gradient tiles store GPU cache
         //           handles that are cleared (and thus invalidated + re-uploaded)
         //           every frame. This maintains the existing behavior, but we
         //           should fix this in the future to retain handles.
         self.gradient_tiles.clear();
 
         self.prim_info.clear();
 
-        #[cfg(feature = "debug_renderer")]
         self.debug_items.clear();
     }
 
     #[allow(dead_code)]
-    #[cfg(feature = "debug_renderer")]
     pub fn push_debug_rect(
         &mut self,
         rect: DeviceRect,
         color: ColorF,
     ) {
         self.debug_items.push(DebugItem::Rect {
             rect,
             color: color.into(),
         });
     }
 
     #[allow(dead_code)]
-    #[cfg(feature = "debug_renderer")]
     pub fn push_debug_string(
         &mut self,
         position: DevicePoint,
         color: ColorF,
         msg: String,
     ) {
         self.debug_items.push(DebugItem::Text {
             position,
@@ -1991,35 +1982,32 @@ impl PrimitiveStore {
                     Some(rect) => rect,
                     None => {
                         continue;
                     }
                 };
 
                 // When the debug display is enabled, paint a colored rectangle around each
                 // primitive.
-                #[cfg(feature = "debug_renderer")]
-                {
-                    if frame_context.debug_flags.contains(::api::DebugFlags::PRIMITIVE_DBG) {
-                        let debug_color = match prim_instance.kind {
-                            PrimitiveInstanceKind::Picture { .. } => debug_colors::GREEN,
-                            PrimitiveInstanceKind::TextRun { .. } => debug_colors::RED,
-                            PrimitiveInstanceKind::LineDecoration { .. } => debug_colors::PURPLE,
-                            PrimitiveInstanceKind::NormalBorder { .. } |
-                            PrimitiveInstanceKind::ImageBorder { .. } => debug_colors::ORANGE,
-                            PrimitiveInstanceKind::Rectangle { .. } => ColorF { r: 0.8, g: 0.8, b: 0.8, a: 0.5 },
-                            PrimitiveInstanceKind::YuvImage { .. } => debug_colors::BLUE,
-                            PrimitiveInstanceKind::Image { .. } => debug_colors::BLUE,
-                            PrimitiveInstanceKind::LinearGradient { .. } => debug_colors::PINK,
-                            PrimitiveInstanceKind::RadialGradient { .. } => debug_colors::PINK,
-                            PrimitiveInstanceKind::Clear { .. } => debug_colors::CYAN,
-                        };
-                        let debug_rect = clipped_world_rect * frame_context.device_pixel_scale;
-                        frame_state.scratch.push_debug_rect(debug_rect, debug_color);
-                    }
+                if frame_context.debug_flags.contains(::api::DebugFlags::PRIMITIVE_DBG) {
+                    let debug_color = match prim_instance.kind {
+                        PrimitiveInstanceKind::Picture { .. } => debug_colors::GREEN,
+                        PrimitiveInstanceKind::TextRun { .. } => debug_colors::RED,
+                        PrimitiveInstanceKind::LineDecoration { .. } => debug_colors::PURPLE,
+                        PrimitiveInstanceKind::NormalBorder { .. } |
+                        PrimitiveInstanceKind::ImageBorder { .. } => debug_colors::ORANGE,
+                        PrimitiveInstanceKind::Rectangle { .. } => ColorF { r: 0.8, g: 0.8, b: 0.8, a: 0.5 },
+                        PrimitiveInstanceKind::YuvImage { .. } => debug_colors::BLUE,
+                        PrimitiveInstanceKind::Image { .. } => debug_colors::BLUE,
+                        PrimitiveInstanceKind::LinearGradient { .. } => debug_colors::PINK,
+                        PrimitiveInstanceKind::RadialGradient { .. } => debug_colors::PINK,
+                        PrimitiveInstanceKind::Clear { .. } => debug_colors::CYAN,
+                    };
+                    let debug_rect = clipped_world_rect * frame_context.device_pixel_scale;
+                    frame_state.scratch.push_debug_rect(debug_rect, debug_color);
                 }
 
                 let vis_index = PrimitiveVisibilityIndex(frame_state.scratch.prim_info.len() as u32);
 
                 frame_state.scratch.prim_info.push(
                     PrimitiveVisibility {
                         clipped_world_rect,
                         clip_chain,
--- a/gfx/wr/webrender/src/profiler.rs
+++ b/gfx/wr/webrender/src/profiler.rs
@@ -1,39 +1,27 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-use api::ColorF;
-use device::query::{GpuTimer, NamedTag};
+use api::{ColorF, ColorU};
+use debug_render::DebugRenderer;
+use device::query::{GpuSampler, GpuTimer, NamedTag};
+use euclid::{Point2D, Rect, Size2D, vec2};
+use internal_types::FastHashMap;
+use renderer::MAX_VERTEX_TEXTURE_WIDTH;
 use std::collections::vec_deque::VecDeque;
-use std::f32;
+use std::{f32, mem};
 use time::precise_time_ns;
 
-cfg_if! {
-    if #[cfg(feature = "debug_renderer")] {
-        use api::ColorU;
-        use debug_render::DebugRenderer;
-        use euclid::{Point2D, Rect, Size2D, vec2};
-        use device::query::GpuSampler;
-        use internal_types::FastHashMap;
-        use renderer::MAX_VERTEX_TEXTURE_WIDTH;
-        use std::mem;
-    }
-}
-
-cfg_if! {
-    if #[cfg(feature = "debug_renderer")] {
-        const GRAPH_WIDTH: f32 = 1024.0;
-        const GRAPH_HEIGHT: f32 = 320.0;
-        const GRAPH_PADDING: f32 = 8.0;
-        const GRAPH_FRAME_HEIGHT: f32 = 16.0;
-        const PROFILE_PADDING: f32 = 10.0;
-    }
-}
+const GRAPH_WIDTH: f32 = 1024.0;
+const GRAPH_HEIGHT: f32 = 320.0;
+const GRAPH_PADDING: f32 = 8.0;
+const GRAPH_FRAME_HEIGHT: f32 = 16.0;
+const PROFILE_PADDING: f32 = 10.0;
 
 const ONE_SECOND_NS: u64 = 1000000000;
 
 #[derive(Debug, Clone)]
 pub struct GpuProfileTag {
     pub label: &'static str,
     pub color: ColorF,
 }
@@ -92,23 +80,21 @@ impl ProfileCounter for IntProfileCounte
         self.description
     }
 
     fn value(&self) -> String {
         format!("{}", self.value)
     }
 }
 
-#[cfg(feature = "debug_renderer")]
 pub struct PercentageProfileCounter {
     description: &'static str,
     value: f32,
 }
 
-#[cfg(feature = "debug_renderer")]
 impl ProfileCounter for PercentageProfileCounter {
     fn description(&self) -> &'static str {
         self.description
     }
 
     fn value(&self) -> String {
         format!("{:.2}%", self.value * 100.0)
     }
@@ -406,17 +392,16 @@ macro_rules! declare_intern_profile_coun
         #[derive(Clone)]
         pub struct InternProfileCounters {
             $(
                 pub $name: ResourceProfileCounter,
             )+
         }
 
         impl InternProfileCounters {
-            #[cfg(feature = "debug_renderer")]
             fn draw(
                 &self,
                 debug_renderer: &mut DebugRenderer,
                 draw_state: &mut DrawState,
             ) {
                 Profiler::draw_counters(
                     &[
                         $(
@@ -550,36 +535,33 @@ impl RendererProfileTimers {
 
 struct GraphStats {
     min_value: f32,
     mean_value: f32,
     max_value: f32,
 }
 
 struct ProfileGraph {
-    #[cfg(feature = "debug_renderer")]
     max_samples: usize,
     values: VecDeque<f32>,
     short_description: &'static str,
 }
 
 impl ProfileGraph {
-    #[cfg(feature = "debug_renderer")]
     fn new(
         max_samples: usize,
         short_description: &'static str,
     ) -> Self {
         ProfileGraph {
             max_samples,
             values: VecDeque::new(),
             short_description,
         }
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn push(&mut self, ns: u64) {
         let ms = ns as f64 / 1000000.0;
         if self.values.len() == self.max_samples {
             self.values.pop_back();
         }
         self.values.push_front(ms as f32);
     }
 
@@ -598,17 +580,16 @@ impl ProfileGraph {
 
         if !self.values.is_empty() {
             stats.mean_value = stats.mean_value / self.values.len() as f32;
         }
 
         stats
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn draw_graph(
         &self,
         x: f32,
         y: f32,
         description: &'static str,
         debug_renderer: &mut DebugRenderer,
     ) -> Rect<f32> {
         let size = Size2D::new(600.0, 120.0);
@@ -702,28 +683,25 @@ impl ProfileCounter for ProfileGraph {
         self.short_description
     }
 
     fn value(&self) -> String {
         format!("{:.2}ms", self.stats().mean_value)
     }
 }
 
-#[cfg(feature = "debug_renderer")]
 struct GpuFrame {
     total_time: u64,
     samples: Vec<GpuTimer<GpuProfileTag>>,
 }
 
-#[cfg(feature = "debug_renderer")]
 struct GpuFrameCollection {
     frames: VecDeque<GpuFrame>,
 }
 
-#[cfg(feature = "debug_renderer")]
 impl GpuFrameCollection {
     fn new() -> Self {
         GpuFrameCollection {
             frames: VecDeque::new(),
         }
     }
 
     fn push(&mut self, total_time: u64, samples: Vec<GpuTimer<GpuProfileTag>>) {
@@ -732,17 +710,16 @@ impl GpuFrameCollection {
         }
         self.frames.push_front(GpuFrame {
             total_time,
             samples,
         });
     }
 }
 
-#[cfg(feature = "debug_renderer")]
 impl GpuFrameCollection {
     fn draw(&self, x: f32, y: f32, debug_renderer: &mut DebugRenderer) -> Rect<f32> {
         let graph_rect = Rect::new(
             Point2D::new(x, y),
             Size2D::new(GRAPH_WIDTH, GRAPH_HEIGHT),
         );
         let bounding_rect = graph_rect.inflate(GRAPH_PADDING, GRAPH_PADDING);
 
@@ -824,35 +801,32 @@ impl GpuFrameCollection {
                 None,
             );
         }
 
         bounding_rect
     }
 }
 
-#[cfg(feature = "debug_renderer")]
 struct DrawState {
     x_left: f32,
     y_left: f32,
     x_right: f32,
     y_right: f32,
 }
 
-#[cfg(feature = "debug_renderer")]
 pub struct Profiler {
     draw_state: DrawState,
     backend_time: ProfileGraph,
     compositor_time: ProfileGraph,
     gpu_time: ProfileGraph,
     gpu_frames: GpuFrameCollection,
     ipc_time: ProfileGraph,
 }
 
-#[cfg(feature = "debug_renderer")]
 impl Profiler {
     pub fn new() -> Self {
         Profiler {
             draw_state: DrawState {
                 x_left: 0.0,
                 y_left: 0.0,
                 x_right: 0.0,
                 y_right: 0.0,
@@ -1279,22 +1253,20 @@ impl Profiler {
                 gpu_samplers,
                 screen_fraction,
                 debug_renderer,
             );
         }
     }
 }
 
-#[cfg(feature = "debug_renderer")]
 pub struct ChangeIndicator {
     counter: u32,
 }
 
-#[cfg(feature = "debug_renderer")]
 impl ChangeIndicator {
     pub fn new() -> Self {
         ChangeIndicator {
             counter: 0
         }
     }
 
     pub fn changed(&mut self) {
--- a/gfx/wr/webrender/src/renderer.rs
+++ b/gfx/wr/webrender/src/renderer.rs
@@ -17,57 +17,56 @@
 //! calling into WebRender, which means that this module also serves as the
 //! initial entry point into WebRender, and is responsible for spawning the
 //! various other threads discussed above. That said, WebRender initialization
 //! returns both the `Renderer` instance as well as a channel for communicating
 //! directly with the `RenderBackend`. Aside from a few high-level operations
 //! like 'render now', most of interesting commands from the consumer go over
 //! that channel and operate on the `RenderBackend`.
 
-use api::{BlobImageHandler, ColorF, DeviceIntPoint, DeviceIntRect, DeviceIntSize};
+use api::{BlobImageHandler, ColorF, ColorU, DeviceIntPoint, DeviceIntRect, DeviceIntSize};
 use api::{DocumentId, Epoch, ExternalImageId};
 use api::{ExternalImageType, FontRenderMode, FrameMsg, ImageFormat, PipelineId};
 use api::{ImageRendering, Checkpoint, NotificationRequest};
 use api::{MemoryReport, VoidPtrToSizeFn};
 use api::{RenderApiSender, RenderNotifier, TexelRect, TextureTarget};
 use api::{channel};
 use api::DebugCommand;
 pub use api::DebugFlags;
 use api::channel::PayloadReceiverHelperMethods;
 use batch::{BatchKind, BatchTextures, BrushBatchKind};
 #[cfg(any(feature = "capture", feature = "replay"))]
 use capture::{CaptureConfig, ExternalCaptureImage, PlainExternalImage};
 use debug_colors;
-#[cfg(feature = "debug_renderer")]
-use debug_render::DebugItem;
+use debug_render::{DebugItem, DebugRenderer};
 use device::{DepthFunction, Device, GpuFrameId, Program, UploadMethod, Texture, PBO};
 use device::{DrawTarget, ExternalTexture, FBOId, ReadTarget, TextureSlot};
 use device::{ShaderError, TextureFilter, TextureFlags,
              VertexUsageHint, VAO, VBO, CustomVAO};
 use device::{ProgramCache, ReadPixelsFormat};
-#[cfg(feature = "debug_renderer")]
+use device::query::GpuTimer;
 use euclid::rect;
 use euclid::Transform3D;
 use frame_builder::{ChasePrimitive, FrameBuilderConfig};
 use gleam::gl;
 use glyph_rasterizer::{GlyphFormat, GlyphRasterizer};
 use gpu_cache::{GpuBlockData, GpuCacheUpdate, GpuCacheUpdateList};
-#[cfg(feature = "debug_renderer")]
 use gpu_cache::{GpuCacheDebugChunk, GpuCacheDebugCmd};
 #[cfg(feature = "pathfinder")]
 use gpu_glyph_renderer::GpuGlyphRenderer;
 use gpu_types::ScalingInstance;
 use internal_types::{TextureSource, ORTHO_FAR_PLANE, ORTHO_NEAR_PLANE, ResourceCacheError};
 use internal_types::{CacheTextureId, DebugOutput, FastHashMap, LayerIndex, RenderedDocument, ResultMsg};
 use internal_types::{TextureCacheAllocationKind, TextureCacheUpdate, TextureUpdateList, TextureUpdateSource};
 use internal_types::{RenderTargetInfo, SavedTargetIndex};
 use malloc_size_of::MallocSizeOfOps;
 use prim_store::DeferredResolve;
 use profiler::{BackendProfileCounters, FrameProfileCounters, TimeProfileCounter,
                GpuProfileTag, RendererProfileCounters, RendererProfileTimers};
+use profiler::{Profiler, ChangeIndicator};
 use device::query::GpuProfiler;
 use rayon::{ThreadPool, ThreadPoolBuilder};
 use record::ApiRecordingReceiver;
 use render_backend::{FrameId, RenderBackend};
 use render_task::ClearMode;
 use scene_builder::{SceneBuilder, LowPrioritySceneBuilder};
 use shade::{Shaders, WrShaders};
 use smallvec::SmallVec;
@@ -102,25 +101,16 @@ cfg_if! {
         use serde_json;
         use debug_server::{self, DebugServer};
     } else {
         use api::ApiMsg;
         use api::channel::MsgSender;
     }
 }
 
-cfg_if! {
-    if #[cfg(feature = "debug_renderer")] {
-        use api::ColorU;
-        use debug_render::DebugRenderer;
-        use profiler::{Profiler, ChangeIndicator};
-        use device::query::GpuTimer;
-    }
-}
-
 pub const MAX_VERTEX_TEXTURE_WIDTH: usize = 1024;
 /// Enabling this toggle would force the GPU cache scattered texture to
 /// be resized every frame, which enables GPU debuggers to see if this
 /// is performed correctly.
 const GPU_CACHE_RESIZE_TEST: bool = false;
 
 /// Number of GPU blocks per UV rectangle provided for an image.
 pub const BLOCKS_PER_UV_RECT: usize = 2;
@@ -705,17 +695,16 @@ pub enum RendererKind {
 
 #[derive(Debug)]
 pub struct GpuProfile {
     pub frame_id: GpuFrameId,
     pub paint_time_ns: u64,
 }
 
 impl GpuProfile {
-    #[cfg(feature = "debug_renderer")]
     fn new<T>(frame_id: GpuFrameId, timers: &[GpuTimer<T>]) -> GpuProfile {
         let mut paint_time_ns = 0;
         for timer in timers {
             paint_time_ns += timer.time_ns;
         }
         GpuProfile {
             frame_id,
             paint_time_ns,
@@ -1419,23 +1408,21 @@ struct FrameOutput {
 
 #[derive(PartialEq)]
 struct TargetSelector {
     size: DeviceIntSize,
     num_layers: usize,
     format: ImageFormat,
 }
 
-#[cfg(feature = "debug_renderer")]
 struct LazyInitializedDebugRenderer {
     debug_renderer: Option<DebugRenderer>,
     failed: bool,
 }
 
-#[cfg(feature = "debug_renderer")]
 impl LazyInitializedDebugRenderer {
     pub fn new() -> Self {
         Self {
             debug_renderer: None,
             failed: false,
         }
     }
 
@@ -1497,47 +1484,41 @@ pub struct Renderer {
     shaders: Rc<RefCell<Shaders>>,
 
     pub gpu_glyph_renderer: GpuGlyphRenderer,
 
     max_recorded_profiles: usize,
 
     clear_color: Option<ColorF>,
     enable_clear_scissor: bool,
-    #[cfg(feature = "debug_renderer")]
     debug: LazyInitializedDebugRenderer,
     debug_flags: DebugFlags,
     backend_profile_counters: BackendProfileCounters,
     profile_counters: RendererProfileCounters,
     resource_upload_time: u64,
     gpu_cache_upload_time: u64,
-    #[cfg(feature = "debug_renderer")]
     profiler: Profiler,
-    #[cfg(feature = "debug_renderer")]
     new_frame_indicator: ChangeIndicator,
-    #[cfg(feature = "debug_renderer")]
     new_scene_indicator: ChangeIndicator,
-    #[cfg(feature = "debug_renderer")]
     slow_frame_indicator: ChangeIndicator,
 
     last_time: u64,
 
     pub gpu_profile: GpuProfiler<GpuProfileTag>,
     vaos: RendererVAOs,
 
     prim_header_f_texture: VertexDataTexture,
     prim_header_i_texture: VertexDataTexture,
     transforms_texture: VertexDataTexture,
     render_task_texture: VertexDataTexture,
     gpu_cache_texture: GpuCacheTexture,
 
     /// When the GPU cache debugger is enabled, we keep track of the live blocks
     /// in the GPU cache so that we can use them for the debug display. This
     /// member stores those live blocks, indexed by row.
-    #[cfg(feature = "debug_renderer")]
     gpu_cache_debug_chunks: Vec<Vec<GpuCacheDebugChunk>>,
 
     gpu_cache_frame_id: FrameId,
     gpu_cache_overflow: bool,
 
     pipeline_info: PipelineInfo,
 
     // Manages and resolves source textures IDs to real texture IDs.
@@ -1963,30 +1944,25 @@ impl Renderer {
             debug_server,
             device,
             active_documents: Vec::new(),
             pending_texture_updates: Vec::new(),
             pending_gpu_cache_updates: Vec::new(),
             pending_gpu_cache_clear: false,
             pending_shader_updates: Vec::new(),
             shaders,
-            #[cfg(feature = "debug_renderer")]
             debug: LazyInitializedDebugRenderer::new(),
             debug_flags: DebugFlags::empty(),
             backend_profile_counters: BackendProfileCounters::new(),
             profile_counters: RendererProfileCounters::new(),
             resource_upload_time: 0,
             gpu_cache_upload_time: 0,
-            #[cfg(feature = "debug_renderer")]
             profiler: Profiler::new(),
-            #[cfg(feature = "debug_renderer")]
             new_frame_indicator: ChangeIndicator::new(),
-            #[cfg(feature = "debug_renderer")]
             new_scene_indicator: ChangeIndicator::new(),
-            #[cfg(feature = "debug_renderer")]
             slow_frame_indicator: ChangeIndicator::new(),
             max_recorded_profiles: options.max_recorded_profiles,
             clear_color: options.clear_color,
             enable_clear_scissor: options.enable_clear_scissor,
             last_time: 0,
             gpu_profile,
             gpu_glyph_renderer,
             vaos: RendererVAOs {
@@ -2005,17 +1981,16 @@ impl Renderer {
             dither_matrix_texture,
             external_image_handler: None,
             output_image_handler: None,
             size_of_ops: make_size_of_ops(),
             output_targets: FastHashMap::default(),
             cpu_profiles: VecDeque::new(),
             gpu_profiles: VecDeque::new(),
             gpu_cache_texture,
-            #[cfg(feature = "debug_renderer")]
             gpu_cache_debug_chunks: Vec::new(),
             gpu_cache_frame_id: FrameId::INVALID,
             gpu_cache_overflow: false,
             texture_cache_upload_pbo,
             texture_resolver,
             renderer_errors: Vec::new(),
             #[cfg(feature = "capture")]
             read_fbo,
@@ -2076,17 +2051,16 @@ impl Renderer {
                 }
                 ResultMsg::PublishDocument(
                     document_id,
                     mut doc,
                     texture_update_list,
                     profile_counters,
                 ) => {
                     if doc.is_new_scene {
-                        #[cfg(feature = "debug_renderer")]
                         self.new_scene_indicator.changed();
                     }
 
                     // Add a new document to the active set, expressed as a `Vec` in order
                     // to re-order based on `DocumentLayer` during rendering.
                     match self.active_documents.iter().position(|&(id, _)| id == document_id) {
                         Some(pos) => {
                             // If the document we are replacing must be drawn
@@ -2114,37 +2088,34 @@ impl Renderer {
                     //TODO: associate `document_id` with target window
                     self.pending_texture_updates.push(texture_update_list);
                     self.backend_profile_counters = profile_counters;
                 }
                 ResultMsg::UpdateGpuCache(mut list) => {
                     if list.clear {
                         self.pending_gpu_cache_clear = true;
                     }
-                    #[cfg(feature = "debug_renderer")]
-                    {
-                        if list.clear {
-                            self.gpu_cache_debug_chunks = Vec::new();
-                        }
-                        for cmd in mem::replace(&mut list.debug_commands, Vec::new()) {
-                            match cmd {
-                                GpuCacheDebugCmd::Alloc(chunk) => {
-                                    let row = chunk.address.v as usize;
-                                    if row >= self.gpu_cache_debug_chunks.len() {
-                                        self.gpu_cache_debug_chunks.resize(row + 1, Vec::new());
-                                    }
-                                    self.gpu_cache_debug_chunks[row].push(chunk);
-                                },
-                                GpuCacheDebugCmd::Free(address) => {
-                                    let chunks = &mut self.gpu_cache_debug_chunks[address.v as usize];
-                                    let pos = chunks.iter()
-                                        .position(|x| x.address == address).unwrap();
-                                    chunks.remove(pos);
-                                },
-                            }
+                    if list.clear {
+                        self.gpu_cache_debug_chunks = Vec::new();
+                    }
+                    for cmd in mem::replace(&mut list.debug_commands, Vec::new()) {
+                        match cmd {
+                            GpuCacheDebugCmd::Alloc(chunk) => {
+                                let row = chunk.address.v as usize;
+                                if row >= self.gpu_cache_debug_chunks.len() {
+                                    self.gpu_cache_debug_chunks.resize(row + 1, Vec::new());
+                                }
+                                self.gpu_cache_debug_chunks[row].push(chunk);
+                            },
+                            GpuCacheDebugCmd::Free(address) => {
+                                let chunks = &mut self.gpu_cache_debug_chunks[address.v as usize];
+                                let pos = chunks.iter()
+                                    .position(|x| x.address == address).unwrap();
+                                chunks.remove(pos);
+                            },
                         }
                     }
                     self.pending_gpu_cache_updates.push(list);
                 }
                 ResultMsg::UpdateResources {
                     updates,
                     memory_pressure,
                 } => {
@@ -2466,17 +2437,16 @@ impl Renderer {
                 }
             }
         }
 
         false
     }
 
     pub fn notify_slow_frame(&mut self) {
-        #[cfg(feature = "debug_renderer")]
         self.slow_frame_indicator.changed();
     }
 
     /// Renders the current frame.
     ///
     /// A Frame is supplied by calling [`generate_frame()`][webrender_api::Transaction::generate_frame].
     pub fn render(
         &mut self,
@@ -2513,17 +2483,16 @@ impl Renderer {
             self.last_time = precise_time_ns();
             return Ok(RendererStats::empty());
         }
 
         let mut stats = RendererStats::empty();
         let mut frame_profiles = Vec::new();
         let mut profile_timers = RendererProfileTimers::new();
 
-        #[cfg(feature = "debug_renderer")]
         let profile_samplers = {
             let _gm = self.gpu_profile.start_marker("build samples");
             // Block CPU waiting for last frame's GPU profiles to arrive.
             // In general this shouldn't block unless heavily GPU limited.
             let (gpu_frame_id, timers, samplers) = self.gpu_profile.build_samples();
 
             if self.max_recorded_profiles > 0 {
                 while self.gpu_profiles.len() >= self.max_recorded_profiles {
@@ -2630,69 +2599,66 @@ impl Renderer {
                 cpu_frame_id,
                 self.backend_profile_counters.total_time.get(),
                 profile_timers.cpu_time.get(),
                 self.profile_counters.draw_calls.get(),
             );
             self.cpu_profiles.push_back(cpu_profile);
         }
 
-        #[cfg(feature = "debug_renderer")]
-        {
-            if self.debug_flags.contains(DebugFlags::PROFILER_DBG) {
-                if let Some(framebuffer_size) = framebuffer_size {
-                    //TODO: take device/pixel ratio into equation?
-                    if let Some(debug_renderer) = self.debug.get_mut(&mut self.device) {
-                        let screen_fraction = 1.0 / framebuffer_size.to_f32().area();
-                        self.profiler.draw_profile(
-                            &frame_profiles,
-                            &self.backend_profile_counters,
-                            &self.profile_counters,
-                            &mut profile_timers,
-                            &profile_samplers,
-                            screen_fraction,
-                            debug_renderer,
-                            self.debug_flags.contains(DebugFlags::COMPACT_PROFILER),
-                        );
-                    }
+        if self.debug_flags.contains(DebugFlags::PROFILER_DBG) {
+            if let Some(framebuffer_size) = framebuffer_size {
+                //TODO: take device/pixel ratio into equation?
+                if let Some(debug_renderer) = self.debug.get_mut(&mut self.device) {
+                    let screen_fraction = 1.0 / framebuffer_size.to_f32().area();
+                    self.profiler.draw_profile(
+                        &frame_profiles,
+                        &self.backend_profile_counters,
+                        &self.profile_counters,
+                        &mut profile_timers,
+                        &profile_samplers,
+                        screen_fraction,
+                        debug_renderer,
+                        self.debug_flags.contains(DebugFlags::COMPACT_PROFILER),
+                    );
                 }
             }
-
-            let mut x = 0.0;
-            if self.debug_flags.contains(DebugFlags::NEW_FRAME_INDICATOR) {
-                if let Some(debug_renderer) = self.debug.get_mut(&mut self.device) {
-                    self.new_frame_indicator.changed();
-                    self.new_frame_indicator.draw(
-                        x, 0.0,
-                        ColorU::new(0, 110, 220, 255),
-                        debug_renderer,
-                    );
-                    x += ChangeIndicator::width();
-                }
+        }
+
+        let mut x = 0.0;
+        if self.debug_flags.contains(DebugFlags::NEW_FRAME_INDICATOR) {
+            if let Some(debug_renderer) = self.debug.get_mut(&mut self.device) {
+                self.new_frame_indicator.changed();
+                self.new_frame_indicator.draw(
+                    x, 0.0,
+                    ColorU::new(0, 110, 220, 255),
+                    debug_renderer,
+                );
+                x += ChangeIndicator::width();
             }
-
-            if self.debug_flags.contains(DebugFlags::NEW_SCENE_INDICATOR) {
-                if let Some(debug_renderer) = self.debug.get_mut(&mut self.device) {
-                    self.new_scene_indicator.draw(
-                        x, 0.0,
-                        ColorU::new(0, 220, 110, 255),
-                        debug_renderer,
-                    );
-                    x += ChangeIndicator::width();
-                }
+        }
+
+        if self.debug_flags.contains(DebugFlags::NEW_SCENE_INDICATOR) {
+            if let Some(debug_renderer) = self.debug.get_mut(&mut self.device) {
+                self.new_scene_indicator.draw(
+                    x, 0.0,
+                    ColorU::new(0, 220, 110, 255),
+                    debug_renderer,
+                );
+                x += ChangeIndicator::width();
             }
-
-            if self.debug_flags.contains(DebugFlags::SLOW_FRAME_INDICATOR) {
-                if let Some(debug_renderer) = self.debug.get_mut(&mut self.device) {
-                    self.slow_frame_indicator.draw(
-                        x, 0.0,
-                        ColorU::new(220, 30, 10, 255),
-                        debug_renderer,
-                    );
-                }
+        }
+
+        if self.debug_flags.contains(DebugFlags::SLOW_FRAME_INDICATOR) {
+            if let Some(debug_renderer) = self.debug.get_mut(&mut self.device) {
+                self.slow_frame_indicator.draw(
+                    x, 0.0,
+                    ColorU::new(220, 30, 10, 255),
+                    debug_renderer,
+                );
             }
         }
 
         if self.debug_flags.contains(DebugFlags::ECHO_DRIVER_MESSAGES) {
             self.device.echo_driver_messages();
         }
 
         stats.texture_upload_kb = self.profile_counters.texture_data_uploaded.get();
@@ -2702,21 +2668,18 @@ impl Renderer {
         stats.resource_upload_time = self.resource_upload_time;
         self.resource_upload_time = 0;
         stats.gpu_cache_upload_time = self.gpu_cache_upload_time;
         self.gpu_cache_upload_time = 0;
 
         profile_timers.cpu_time.profile(|| {
             let _gm = self.gpu_profile.start_marker("end frame");
             self.gpu_profile.end_frame();
-            #[cfg(feature = "debug_renderer")]
-            {
-                if let Some(debug_renderer) = self.debug.try_get_mut() {
-                    debug_renderer.render(&mut self.device, framebuffer_size);
-                }
+            if let Some(debug_renderer) = self.debug.try_get_mut() {
+                debug_renderer.render(&mut self.device, framebuffer_size);
             }
             self.device.end_frame();
         });
         if framebuffer_size.is_some() {
             self.last_time = current_time;
         }
 
         if self.renderer_errors.is_empty() {
@@ -4222,41 +4185,37 @@ impl Renderer {
                 &mut self.device,
                 cur_alpha,
                 cur_color,
             );
         }
 
         self.texture_resolver.end_frame(&mut self.device, frame_id);
 
-        #[cfg(feature = "debug_renderer")]
-        {
-            if let Some(framebuffer_size) = framebuffer_size {
-                self.draw_frame_debug_items(&frame.debug_items);
-                self.draw_render_target_debug(framebuffer_size);
-                self.draw_texture_cache_debug(framebuffer_size);
-                self.draw_gpu_cache_debug(framebuffer_size);
-            }
-            self.draw_epoch_debug();
+        if let Some(framebuffer_size) = framebuffer_size {
+            self.draw_frame_debug_items(&frame.debug_items);
+            self.draw_render_target_debug(framebuffer_size);
+            self.draw_texture_cache_debug(framebuffer_size);
+            self.draw_gpu_cache_debug(framebuffer_size);
         }
+        self.draw_epoch_debug();
 
         // Garbage collect any frame outputs that weren't used this frame.
         let device = &mut self.device;
         self.output_targets
             .retain(|_, target| if target.last_access != frame_id {
                 device.delete_fbo(target.fbo_id);
                 false
             } else {
                 true
             });
 
         frame.has_been_rendered = true;
     }
 
-    #[cfg(feature = "debug_renderer")]
     pub fn debug_renderer<'b>(&'b mut self) -> Option<&'b mut DebugRenderer> {
         self.debug.get_mut(&mut self.device)
     }
 
     pub fn get_debug_flags(&self) -> DebugFlags {
         self.debug_flags
     }
 
@@ -4278,17 +4237,16 @@ impl Renderer {
 
         self.debug_flags = flags;
     }
 
     pub fn save_cpu_profile(&self, filename: &str) {
         write_profile(filename);
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn draw_frame_debug_items(&mut self, items: &[DebugItem]) {
         let debug_renderer = match self.debug.get_mut(&mut self.device) {
             Some(render) => render,
             None => return,
         };
 
         for item in items {
             match item {
@@ -4318,17 +4276,16 @@ impl Renderer {
                         (*color).into(),
                         None,
                     );
                 }
             }
         }
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn draw_render_target_debug(&mut self, framebuffer_size: DeviceIntSize) {
         if !self.debug_flags.contains(DebugFlags::RENDER_TARGET_DBG) {
             return;
         }
 
         let debug_renderer = match self.debug.get_mut(&mut self.device) {
             Some(render) => render,
             None => return,
@@ -4342,17 +4299,16 @@ impl Renderer {
             debug_renderer,
             textures,
             framebuffer_size,
             0,
             &|_| [0.0, 1.0, 0.0, 1.0], // Use green for all RTs.
         );
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn draw_texture_cache_debug(&mut self, framebuffer_size: DeviceIntSize) {
         if !self.debug_flags.contains(DebugFlags::TEXTURE_CACHE_DBG) {
             return;
         }
 
         let debug_renderer = match self.debug.get_mut(&mut self.device) {
             Some(render) => render,
             None => return,
@@ -4374,17 +4330,16 @@ impl Renderer {
             debug_renderer,
             textures,
             framebuffer_size,
             if self.debug_flags.contains(DebugFlags::RENDER_TARGET_DBG) { 544 } else { 0 },
             &select_color,
         );
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn do_debug_blit(
         device: &mut Device,
         debug_renderer: &mut DebugRenderer,
         mut textures: Vec<&Texture>,
         framebuffer_size: DeviceIntSize,
         bottom: i32,
         select_color: &Fn(&Texture) -> [f32; 4],
     ) {
@@ -4456,17 +4411,16 @@ impl Renderer {
                 // use different conventions.
                 let dest_rect = rect(x, y + tag_height, size, size);
                 device.blit_render_target_invert_y(src_rect, dest_rect);
                 i += 1;
             }
         }
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn draw_epoch_debug(&mut self) {
         if !self.debug_flags.contains(DebugFlags::EPOCHS) {
             return;
         }
 
         let debug_renderer = match self.debug.get_mut(&mut self.device) {
             Some(render) => render,
             None => return,
@@ -4494,17 +4448,16 @@ impl Renderer {
             y0 - margin,
             x0 + text_width + margin,
             y + margin,
             ColorU::new(25, 25, 25, 200),
             ColorU::new(51, 51, 51, 200),
         );
     }
 
-    #[cfg(feature = "debug_renderer")]
     fn draw_gpu_cache_debug(&mut self, framebuffer_size: DeviceIntSize) {
         if !self.debug_flags.contains(DebugFlags::GPU_CACHE_DBG) {
             return;
         }
 
         let debug_renderer = match self.debug.get_mut(&mut self.device) {
             Some(render) => render,
             None => return,
@@ -4580,20 +4533,17 @@ impl Renderer {
         self.texture_resolver.deinit(&mut self.device);
         self.device.delete_vao(self.vaos.prim_vao);
         self.device.delete_vao(self.vaos.clip_vao);
         self.device.delete_vao(self.vaos.blur_vao);
         self.device.delete_vao(self.vaos.line_vao);
         self.device.delete_vao(self.vaos.border_vao);
         self.device.delete_vao(self.vaos.scale_vao);
 
-        #[cfg(feature = "debug_renderer")]
-        {
-            self.debug.deinit(&mut self.device);
-        }
+        self.debug.deinit(&mut self.device);
 
         for (_, target) in self.output_targets {
             self.device.delete_fbo(target.fbo_id);
         }
         if let Ok(shaders) = Rc::try_unwrap(self.shaders) {
             shaders.into_inner().deinit(&mut self.device);
         }
         #[cfg(feature = "capture")]
--- a/gfx/wr/webrender/src/tiling.rs
+++ b/gfx/wr/webrender/src/tiling.rs
@@ -3,17 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use api::{ColorF, BorderStyle, DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixelScale};
 use api::{DocumentLayer, FilterOp, ImageFormat};
 use api::{MixBlendMode, PipelineId, DeviceRect, LayoutSize};
 use batch::{AlphaBatchBuilder, AlphaBatchContainer, ClipBatcher, resolve_image};
 use clip::ClipStore;
 use clip_scroll_tree::{ClipScrollTree};
-#[cfg(feature = "debug_renderer")]
 use debug_render::DebugItem;
 use device::{Texture};
 #[cfg(feature = "pathfinder")]
 use euclid::{TypedPoint2D, TypedVector2D};
 use gpu_cache::{GpuCache};
 use gpu_types::{BorderInstance, BlurDirection, BlurInstance, PrimitiveHeaders, ScalingInstance};
 use gpu_types::{TransformData, TransformPalette, ZBufferIdGenerator};
 use internal_types::{CacheTextureId, FastHashMap, SavedTargetIndex, TextureSource};
@@ -1113,17 +1112,16 @@ pub struct Frame {
     /// that write to the texture cache.
     pub has_texture_cache_tasks: bool,
 
     /// True if this frame has been drawn by the
     /// renderer.
     pub has_been_rendered: bool,
 
     /// Debugging information to overlay for this frame.
-    #[cfg(feature = "debug_renderer")]
     pub debug_items: Vec<DebugItem>,
 }
 
 impl Frame {
     // This frame must be flushed if it writes to the
     // texture cache, and hasn't been drawn yet.
     pub fn must_be_drawn(&self) -> bool {
         self.has_texture_cache_tasks && !self.has_been_rendered