Commit aff13942 authored by Dzmitry Malyshau's avatar Dzmitry Malyshau
Browse files

Bug 1631331 - Handle a case where WebRender can't initialize GPU cache r=jrmuizel a=pascalc

Differential Revision: https://phabricator.services.mozilla.com/D74462
parent ebf7d1a2
......@@ -3430,7 +3430,10 @@ impl Renderer {
}
frame.profile_counters.reset_targets();
self.prepare_gpu_cache(frame);
if let Err(e) = self.prepare_gpu_cache(frame) {
self.renderer_errors.push(e);
continue;
}
assert!(frame.gpu_cache_frame_id <= self.gpu_cache_frame_id,
"Received frame depends on a later GPU cache epoch ({:?}) than one we received last via `UpdateGpuCache` ({:?})",
frame.gpu_cache_frame_id, self.gpu_cache_frame_id);
......@@ -3710,11 +3713,11 @@ impl Renderer {
counters.updated_blocks.set(updated_blocks);
}
fn prepare_gpu_cache(&mut self, frame: &Frame) {
fn prepare_gpu_cache(&mut self, frame: &Frame) -> Result<(), RendererError> {
if self.pending_gpu_cache_clear {
let use_scatter =
matches!(self.gpu_cache_texture.bus, GpuCacheBus::Scatter { .. });
let new_cache = GpuCacheTexture::new(&mut self.device, use_scatter).unwrap();
let new_cache = GpuCacheTexture::new(&mut self.device, use_scatter)?;
let old_cache = mem::replace(&mut self.gpu_cache_texture, new_cache);
old_cache.deinit(&mut self.device);
self.pending_gpu_cache_clear = false;
......@@ -3732,6 +3735,8 @@ impl Renderer {
self.gpu_cache_texture.texture.as_ref().unwrap(),
Swizzle::default(),
);
Ok(())
}
fn update_texture_cache(&mut self) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment