commit bf5e2959c72c0de93fd13ac144f45006cfed42ae
parent 5a7797f073eb9796f546468aa30085d420627777
Author: Nicolas Silva <nical@fastmail.com>
Date: Tue, 9 Dec 2025 08:19:07 +0000
Bug 2004043 - Remove unused fields in PictureCacheEntry. r=gfx-reviewers,jnicol
Differential Revision: https://phabricator.services.mozilla.com/D275068
Diffstat:
2 files changed, 4 insertions(+), 41 deletions(-)
diff --git a/gfx/wr/webrender/src/picture.rs b/gfx/wr/webrender/src/picture.rs
@@ -5412,7 +5412,7 @@ impl PicturePrimitive {
if let Some(TileSurface::Texture { descriptor, .. }) = tile.surface.as_ref() {
if let SurfaceTextureDescriptor::TextureCache { handle: Some(handle), .. } = descriptor {
frame_state.resource_cache
- .picture_textures.request(handle, &mut frame_state.frame_gpu_data.f32);
+ .picture_textures.request(handle);
}
}
@@ -5448,7 +5448,7 @@ impl PicturePrimitive {
// TODO(gw): Consider switching to manual eviction policy?
frame_state.resource_cache
.picture_textures
- .request(handle.as_ref().unwrap(), &mut frame_state.frame_gpu_data.f32);
+ .request(handle.as_ref().unwrap());
} else {
// If the texture was evicted on a previous frame, we need to assume
// that the entire tile rect is dirty.
@@ -5505,7 +5505,6 @@ impl PicturePrimitive {
frame_state.resource_cache.picture_textures.update(
tile_cache.current_tile_size,
handle,
- &mut frame_state.frame_gpu_data.f32,
&mut frame_state.resource_cache.texture_cache.next_id,
&mut frame_state.resource_cache.texture_cache.pending_updates,
);
diff --git a/gfx/wr/webrender/src/picture_textures.rs b/gfx/wr/webrender/src/picture_textures.rs
@@ -12,10 +12,7 @@ use crate::internal_types::{
TextureSource, FrameStamp, FrameId,
};
use crate::profiler::{self, TransactionProfile};
-use crate::gpu_types::{ImageSource, UvRectKind};
use crate::freelist::{FreeList, FreeListHandle, WeakFreeListHandle};
-use crate::renderer::{GpuBufferBuilderF, GpuBufferHandle};
-
#[derive(Debug, PartialEq)]
#[cfg_attr(feature = "capture", derive(Serialize))]
@@ -35,33 +32,12 @@ use std::cmp;
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct PictureCacheEntry {
- /// Size of the requested tile.
- pub size: DeviceIntSize,
/// The last frame this item was requested for rendering.
- // TODO(gw): This stamp is only used for picture cache tiles, and some checks
- // in the glyph cache eviction code. We could probably remove it
- // entirely in future (or move to EntryDetails::Picture).
pub last_access: FrameStamp,
- /// Handle to the resource rect in the float GPU buffer.
- pub uv_rect_handle: GpuBufferHandle,
/// The actual device texture ID this is part of.
pub texture_id: CacheTextureId,
}
-impl PictureCacheEntry {
- fn write_gpu_blocks(&mut self, gpu_buffer: &mut GpuBufferBuilderF) {
- let origin = DeviceIntPoint::zero();
- let image_source = ImageSource {
- p0: origin.to_f32(),
- p1: (origin + self.size).to_f32(),
- uv_rect_kind: UvRectKind::Rect,
- user_data: [0.0; 4],
- };
-
- self.uv_rect_handle = image_source.write_gpu_blocks(gpu_buffer);
- }
-}
-
/// The textures used to hold picture cache tiles.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
@@ -129,7 +105,6 @@ impl PictureTextures {
&mut self,
tile_size: DeviceIntSize,
handle: &mut Option<PictureCacheTextureHandle>,
- gpu_buffer: &mut GpuBufferBuilderF,
next_texture_id: &mut CacheTextureId,
pending_updates: &mut TextureUpdateList,
) {
@@ -154,15 +129,7 @@ impl PictureTextures {
*handle = Some(new_handle);
}
- if let Some(handle) = handle {
- // Upload the resource rect and texture array layer.
- self.cache_entries
- .get_opt_mut(handle)
- .expect("BUG: handle must be valid now")
- .write_gpu_blocks(gpu_buffer);
- } else {
- panic!("The handle should be valid picture cache handle now")
- }
+ assert!(handle.is_some(), "The handle should be valid picture cache handle now");
}
pub fn get_or_allocate_tile(
@@ -216,9 +183,7 @@ impl PictureTextures {
});
let cache_entry = PictureCacheEntry {
- size: tile_size,
last_access: self.now,
- uv_rect_handle: GpuBufferHandle::INVALID,
texture_id,
};
@@ -263,14 +228,13 @@ impl PictureTextures {
}
}
- pub fn request(&mut self, handle: &PictureCacheTextureHandle, gpu_buffer: &mut GpuBufferBuilderF) -> bool {
+ pub fn request(&mut self, handle: &PictureCacheTextureHandle) -> bool {
let entry = self.cache_entries.get_opt_mut(handle);
let now = self.now;
entry.map_or(true, |entry| {
// If an image is requested that is already in the cache,
// refresh the GPU cache data associated with this item.
entry.last_access = now;
- entry.write_gpu_blocks(gpu_buffer);
false
})
}