Skip to content

Commit

Permalink
Removed the mask from BatchTextures
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Nov 11, 2016
1 parent fac6d05 commit 22e4212
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
2 changes: 0 additions & 2 deletions webrender/src/internal_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,12 @@ impl TextureSampler {
#[derive(Copy, Clone, Debug)]
pub struct BatchTextures {
pub colors: [TextureId; 3],
pub mask: TextureId,
}

impl BatchTextures {
pub fn no_texture() -> Self {
BatchTextures {
colors: [TextureId::invalid(); 3],
mask: TextureId::invalid(),
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions webrender/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,6 @@ impl Renderer {
for i in 0..textures.colors.len() {
self.device.bind_texture(TextureSampler::color(i), textures.colors[i]);
}
self.device.bind_texture(TextureSampler::Mask, textures.mask);

for chunk in ubo_data.chunks(max_prim_items) {
let ubo = self.device.create_ubo(&chunk, UBO_BIND_DATA);
Expand Down Expand Up @@ -1100,13 +1099,14 @@ impl Renderer {
shader,
1,
&BatchTextures::no_texture(),
max_cache_instances,
max_prim_items,
&projection);
}

// Draw the clip items into the tiled alpha mask.
if true {
self.gpu_profile.add_marker(GPU_TAG_CACHE_CLIP);
let textures = BatchTextures::no_texture();
// first, mark the target area as opaque
//Note: not needed if we know the target is cleared with opaque
self.device.set_blend(false);
Expand All @@ -1116,7 +1116,7 @@ impl Renderer {
self.draw_ubo_batch(&target.clip_batcher.clears,
shader,
1,
TextureId::invalid(),
&textures,
max_prim_items,
&projection);
}
Expand All @@ -1130,7 +1130,7 @@ impl Renderer {
self.draw_ubo_batch(&target.clip_batcher.rectangles,
shader,
1,
TextureId::invalid(),
&textures,
max_prim_items,
&projection);
}
Expand All @@ -1141,7 +1141,7 @@ impl Renderer {
self.draw_ubo_batch(items,
shader,
1,
TextureId::invalid(),
&textures,
max_prim_items,
&projection);
}
Expand Down Expand Up @@ -1427,7 +1427,7 @@ impl Renderer {
self.draw_ubo_batch(&frame.clear_tiles,
shader,
1,
TextureId::invalid(),
&BatchTextures::no_texture(),
max_prim_items,
&projection);
}
Expand Down
13 changes: 5 additions & 8 deletions webrender/src/tiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,12 @@ impl AlphaBatcher {

let textures = BatchTextures {
colors: ctx.prim_store.get_color_textures(prim_metadata),
mask: prim_metadata.mask_texture_id,
};

batch_key = AlphaBatchKey::primitive(batch_kind,
flags,
blend_mode,
textures);
AlphaBatchKey::primitive(batch_kind,
flags,
blend_mode,
textures)
}
};

Expand Down Expand Up @@ -758,7 +757,6 @@ impl RenderTarget {
// we switch the texture atlas to use texture layers!
let textures = BatchTextures {
colors: ctx.prim_store.get_color_textures(prim_metadata),
mask: prim_metadata.mask_texture_id,
};

debug_assert!(textures.colors[0] != TextureId::invalid());
Expand Down Expand Up @@ -1252,8 +1250,7 @@ impl AlphaBatchKey {
self.blend_mode == other.blend_mode &&
textures_compatible(self.textures.colors[0], other.textures.colors[0]) &&
textures_compatible(self.textures.colors[1], other.textures.colors[1]) &&
textures_compatible(self.textures.colors[2], other.textures.colors[2]) &&
textures_compatible(self.textures.mask, other.textures.mask)
textures_compatible(self.textures.colors[2], other.textures.colors[2])
}
}

Expand Down

0 comments on commit 22e4212

Please sign in to comment.