Bug 1517910 - Update webrender to commit bcc2cde64756e0d90dd8614f923ad74694bcd84c (WR PR #3475). r=kats

https://github.com/servo/webrender/pull/3475

Differential Revision: https://phabricator.services.mozilla.com/D15786

--HG--
extra : moz-landing-system : lando
This commit is contained in:
WR Updater Bot 2019-01-05 21:12:56 +00:00
Родитель 0205519c44
Коммит 7e9242db51
5 изменённых файлов: 26 добавлений и 21 удалений

Просмотреть файл

@ -1 +1 @@
48b6b15e68c935a07d66a36f7ca6dd7438924d57
bcc2cde64756e0d90dd8614f923ad74694bcd84c

Просмотреть файл

@ -304,6 +304,9 @@ pub struct GpuCacheDebugChunk {
pub struct GpuCacheUpdateList {
/// The frame current update list was generated from.
pub frame_id: FrameId,
/// Whether the texture should be cleared before updates
/// are applied.
pub clear: bool,
/// The current height of the texture. The render thread
/// should resize the texture if required.
pub height: i32,
@ -669,6 +672,9 @@ pub struct GpuCache {
saved_block_count: usize,
/// The current debug flags for the system.
debug_flags: DebugFlags,
/// Whether there is a pending clear to send with the
/// next update.
pending_clear: bool,
}
impl GpuCache {
@ -679,17 +685,19 @@ impl GpuCache {
texture: Texture::new(Epoch(0), debug_flags),
saved_block_count: 0,
debug_flags,
pending_clear: false,
}
}
/// Drops everything in the GPU cache. Paired by the caller with a message
/// to the renderer thread telling it to do the same.
/// Drops everything in the GPU cache. Must not be called once gpu cache entries
/// for the next frame have already been requested.
pub fn clear(&mut self) {
assert!(self.texture.updates.is_empty(), "Clearing with pending updates");
let mut next_base_epoch = self.texture.max_epoch;
next_base_epoch.next();
self.texture = Texture::new(next_base_epoch, self.debug_flags);
self.saved_block_count = 0;
self.pending_clear = true;
}
/// Begin a new frame.
@ -805,8 +813,11 @@ impl GpuCache {
/// Extract the pending updates from the cache.
pub fn extract_updates(&mut self) -> GpuCacheUpdateList {
let clear = self.pending_clear;
self.pending_clear = false;
GpuCacheUpdateList {
frame_id: self.frame_id,
clear,
height: self.texture.height,
debug_commands: mem::replace(&mut self.texture.debug_commands, Vec::new()),
updates: mem::replace(&mut self.texture.updates, Vec::new()),

Просмотреть файл

@ -295,7 +295,6 @@ pub enum ResultMsg {
DebugOutput(DebugOutput),
RefreshShader(PathBuf),
UpdateGpuCache(GpuCacheUpdateList),
ClearGpuCache,
UpdateResources {
updates: TextureUpdateList,
memory_pressure: bool,

Просмотреть файл

@ -1008,7 +1008,7 @@ impl RenderBackend {
// recently used resources.
self.resource_cache.clear(ClearCache::all());
self.clear_gpu_cache();
self.gpu_cache.clear();
let pending_update = self.resource_cache.pending_updates();
let msg = ResultMsg::UpdateResources {
@ -1121,7 +1121,7 @@ impl RenderBackend {
// we just clear the cache on toggle.
let changed = self.debug_flags ^ flags;
if changed.contains(DebugFlags::GPU_CACHE_DBG) {
self.clear_gpu_cache();
self.gpu_cache.clear();
}
self.debug_flags = flags;
@ -1181,7 +1181,7 @@ impl RenderBackend {
// long enough, drop it and rebuild it. This needs to be done before any
// updates for this frame are made.
if self.gpu_cache.should_reclaim_memory() {
self.clear_gpu_cache();
self.gpu_cache.clear();
}
for scene_msg in transaction_msg.scene_ops.drain(..) {
@ -1548,13 +1548,6 @@ impl RenderBackend {
// thread waiting on the request.
self.scene_tx.send(SceneBuilderRequest::ReportMemory(report, tx)).unwrap();
}
/// Drops everything in the GPU cache. Must not be called once gpu cache entries
/// for the next frame have already been requested.
fn clear_gpu_cache(&mut self) {
self.gpu_cache.clear();
self.result_tx.send(ResultMsg::ClearGpuCache).unwrap();
}
}
fn get_blob_image_updates(updates: &[ResourceUpdate]) -> Vec<BlobImageKey> {

Просмотреть файл

@ -1086,6 +1086,7 @@ impl GpuCacheTexture {
let blit_source = self.texture.take();
// Create the new texture.
assert!(height >= 2, "Height is too small for ANGLE");
let new_size = DeviceIntSize::new(MAX_VERTEX_TEXTURE_WIDTH as _, height);
let rt_info = Some(RenderTargetInfo { has_depth: false });
let mut texture = device.create_texture(
@ -2120,8 +2121,14 @@ impl Renderer {
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) => {
@ -2142,13 +2149,6 @@ impl Renderer {
}
self.pending_gpu_cache_updates.push(list);
}
ResultMsg::ClearGpuCache => {
#[cfg(feature = "debug_renderer")]
{
self.gpu_cache_debug_chunks = Vec::new();
}
self.pending_gpu_cache_clear = true;
}
ResultMsg::UpdateResources {
updates,
memory_pressure,
@ -2741,6 +2741,7 @@ impl Renderer {
if gpu_cache_height != 0 && GPU_CACHE_RESIZE_TEST {
self.pending_gpu_cache_updates.push(GpuCacheUpdateList {
frame_id: FrameId::INVALID,
clear: false,
height: gpu_cache_height,
blocks: vec![[1f32; 4].into()],
updates: Vec::new(),
@ -3841,6 +3842,7 @@ impl Renderer {
let mut list = GpuCacheUpdateList {
frame_id: FrameId::INVALID,
clear: false,
height: self.gpu_cache_texture.get_height(),
blocks: Vec::new(),
updates: Vec::new(),