зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1694909 - Part 2 - Remove more texture array support code in WebRender. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D106477
This commit is contained in:
Родитель
2d3cce8d9d
Коммит
731bc00cd1
|
@ -56,7 +56,6 @@ pub fn resolve_image(
|
|||
DeviceIntPoint::zero(),
|
||||
image_properties.descriptor.size,
|
||||
),
|
||||
texture_layer: 0,
|
||||
user_data: [0.0, 0.0, 0.0],
|
||||
};
|
||||
|
||||
|
|
|
@ -638,8 +638,6 @@ pub enum ResolvedSurfaceTexture {
|
|||
TextureCache {
|
||||
/// The texture ID to draw to.
|
||||
texture: TextureSource,
|
||||
/// Slice index in the texture array to draw to.
|
||||
layer: i32,
|
||||
},
|
||||
Native {
|
||||
/// The arbitrary id of this tile.
|
||||
|
@ -662,7 +660,6 @@ impl SurfaceTextureDescriptor {
|
|||
|
||||
ResolvedSurfaceTexture::TextureCache {
|
||||
texture: cache_item.texture_id,
|
||||
layer: cache_item.texture_layer,
|
||||
}
|
||||
}
|
||||
SurfaceTextureDescriptor::Native { id } => {
|
||||
|
|
|
@ -274,7 +274,7 @@ impl RenderTarget for ColorRenderTarget {
|
|||
}
|
||||
};
|
||||
|
||||
let (target_rect, _) = task.get_target_rect();
|
||||
let target_rect = task.get_target_rect();
|
||||
|
||||
let scissor_rect = if pic_task.can_merge {
|
||||
None
|
||||
|
@ -418,8 +418,7 @@ impl RenderTarget for ColorRenderTarget {
|
|||
}
|
||||
RenderTaskKind::Blit(ref task_info) => {
|
||||
let target_rect = task
|
||||
.get_target_rect()
|
||||
.0;
|
||||
.get_target_rect();
|
||||
self.blits.push(BlitJob {
|
||||
source: task_info.source,
|
||||
target_rect,
|
||||
|
@ -487,7 +486,7 @@ impl RenderTarget for AlphaRenderTarget {
|
|||
) {
|
||||
profile_scope!("add_task");
|
||||
let task = &render_tasks[task_id];
|
||||
let (target_rect, _) = task.get_target_rect();
|
||||
let target_rect = task.get_target_rect();
|
||||
|
||||
match task.kind {
|
||||
RenderTaskKind::Image(..) |
|
||||
|
@ -627,10 +626,10 @@ impl TextureCacheRenderTarget {
|
|||
|
||||
match task.kind {
|
||||
RenderTaskKind::LineDecoration(ref info) => {
|
||||
self.clears.push(target_rect.0);
|
||||
self.clears.push(target_rect);
|
||||
|
||||
self.line_decorations.push(LineDecorationJob {
|
||||
task_rect: target_rect.0.to_f32(),
|
||||
task_rect: target_rect.to_f32(),
|
||||
local_size: info.local_size,
|
||||
style: info.style as i32,
|
||||
axis_select: match info.orientation {
|
||||
|
@ -654,13 +653,13 @@ impl TextureCacheRenderTarget {
|
|||
// task to this target.
|
||||
self.blits.push(BlitJob {
|
||||
source: task_info.source,
|
||||
target_rect: target_rect.0,
|
||||
target_rect,
|
||||
});
|
||||
}
|
||||
RenderTaskKind::Border(ref task_info) => {
|
||||
self.clears.push(target_rect.0);
|
||||
self.clears.push(target_rect);
|
||||
|
||||
let task_origin = target_rect.0.origin.to_f32();
|
||||
let task_origin = target_rect.origin.to_f32();
|
||||
// TODO(gw): Clone here instead of a move of this vec, since the frame
|
||||
// graph is immutable by this point. It's rare that borders
|
||||
// are drawn since they are persisted in the texture cache,
|
||||
|
@ -692,7 +691,7 @@ impl TextureCacheRenderTarget {
|
|||
}
|
||||
|
||||
self.gradients.push(GradientJob {
|
||||
task_rect: target_rect.0.to_f32(),
|
||||
task_rect: target_rect.to_f32(),
|
||||
axis_select,
|
||||
stops,
|
||||
colors,
|
||||
|
@ -745,13 +744,12 @@ fn add_scaling_instances(
|
|||
) {
|
||||
let target_rect = target_task
|
||||
.get_target_rect()
|
||||
.0
|
||||
.inner_rect(task.padding)
|
||||
.to_f32();
|
||||
|
||||
let source = source_task.unwrap().get_texture_source();
|
||||
|
||||
let (source_rect, source_layer) = source_task.unwrap().location.to_source_rect();
|
||||
let source_rect = source_task.unwrap().get_target_rect();
|
||||
|
||||
instances
|
||||
.entry(source)
|
||||
|
@ -759,7 +757,7 @@ fn add_scaling_instances(
|
|||
.push(ScalingInstance {
|
||||
target_rect,
|
||||
source_rect,
|
||||
source_layer: source_layer as i32,
|
||||
source_layer: 0,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::filterdata::SFilterData;
|
|||
use crate::frame_builder::FrameBuilderConfig;
|
||||
use crate::gpu_cache::{GpuCache, GpuCacheAddress, GpuCacheHandle};
|
||||
use crate::gpu_types::{BorderInstance, ImageSource, UvRectKind};
|
||||
use crate::internal_types::{CacheTextureId, FastHashMap, LayerIndex, TextureSource, Swizzle};
|
||||
use crate::internal_types::{CacheTextureId, FastHashMap, TextureSource, Swizzle};
|
||||
use crate::picture::{ResolvedSurfaceTexture, SurfaceInfo};
|
||||
use crate::prim_store::{ClipData, PictureIndex};
|
||||
use crate::prim_store::gradient::{GRADIENT_FP_STOPS, GradientStopKey};
|
||||
|
@ -19,7 +19,7 @@ use crate::prim_store::gradient::{GRADIENT_FP_STOPS, GradientStopKey};
|
|||
use crate::print_tree::{PrintTreePrinter};
|
||||
use crate::resource_cache::{ResourceCache, ImageRequest};
|
||||
use std::{usize, f32, i32, u32};
|
||||
use crate::render_target::{RenderTargetIndex, RenderTargetKind};
|
||||
use crate::render_target::RenderTargetKind;
|
||||
use crate::render_task_graph::{PassId, RenderTaskId, RenderTaskGraphBuilder};
|
||||
#[cfg(feature = "debugger")]
|
||||
use crate::render_task_graph::RenderTaskGraph;
|
||||
|
@ -134,25 +134,6 @@ impl RenderTaskLocation {
|
|||
RenderTaskLocation::CacheRequest { size } => *size,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_source_rect(&self) -> (DeviceIntRect, LayerIndex) {
|
||||
match *self {
|
||||
RenderTaskLocation::Unallocated { .. } => panic!("Expected position to be set for the task!"),
|
||||
RenderTaskLocation::Dynamic { rect, .. } => (rect, 0),
|
||||
RenderTaskLocation::Static { surface: StaticRenderTaskSurface::PictureCache { .. }, .. } => {
|
||||
panic!("bug: picture cache tasks should never be a source!");
|
||||
}
|
||||
RenderTaskLocation::Static { rect, surface: StaticRenderTaskSurface::TextureCache { layer, .. } } => {
|
||||
(rect, layer)
|
||||
}
|
||||
RenderTaskLocation::Static { rect, surface: StaticRenderTaskSurface::ReadOnly { .. } } => {
|
||||
(rect, 0)
|
||||
}
|
||||
RenderTaskLocation::CacheRequest { .. } => {
|
||||
panic!("should not be called");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -622,7 +603,6 @@ impl RenderTaskKind {
|
|||
pub fn write_task_data(
|
||||
&self,
|
||||
target_rect: DeviceIntRect,
|
||||
target_index: RenderTargetIndex,
|
||||
) -> RenderTaskData {
|
||||
// NOTE: The ordering and layout of these structures are
|
||||
// required to match both the GPU structures declared
|
||||
|
@ -695,7 +675,7 @@ impl RenderTaskKind {
|
|||
target_rect.origin.y as f32,
|
||||
target_rect.size.width as f32,
|
||||
target_rect.size.height as f32,
|
||||
target_index.0 as f32,
|
||||
0.0,
|
||||
data[0],
|
||||
data[1],
|
||||
data[2],
|
||||
|
@ -1519,7 +1499,6 @@ impl RenderTask {
|
|||
pub fn write_gpu_blocks(
|
||||
&mut self,
|
||||
target_rect: DeviceIntRect,
|
||||
target_index: RenderTargetIndex,
|
||||
gpu_cache: &mut GpuCache,
|
||||
) {
|
||||
profile_scope!("write_gpu_blocks");
|
||||
|
|
|
@ -623,19 +623,15 @@ impl RenderTaskGraphBuilder {
|
|||
}
|
||||
// Give the render task an opportunity to add any
|
||||
// information to the GPU cache, if appropriate.
|
||||
let (target_rect, target_index) = task.get_target_rect();
|
||||
let target_rect = task.get_target_rect();
|
||||
|
||||
task.write_gpu_blocks(
|
||||
target_rect,
|
||||
target_index,
|
||||
gpu_cache,
|
||||
);
|
||||
|
||||
graph.task_data.push(
|
||||
task.kind.write_task_data(
|
||||
target_rect,
|
||||
target_index,
|
||||
)
|
||||
task.kind.write_task_data(target_rect)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -2551,8 +2551,8 @@ impl Renderer {
|
|||
// Before submitting the composite batch, do the
|
||||
// framebuffer readbacks that are needed for each
|
||||
// composite operation in this batch.
|
||||
let (readback_rect, readback_layer) = readback.get_target_rect();
|
||||
let (backdrop_rect, _) = backdrop.get_target_rect();
|
||||
let readback_rect = readback.get_target_rect();
|
||||
let backdrop_rect = backdrop.get_target_rect();
|
||||
let (backdrop_screen_origin, _) = match backdrop.kind {
|
||||
RenderTaskKind::Picture(ref task_info) => (task_info.content_origin, task_info.device_pixel_scale),
|
||||
_ => panic!("bug: composite on non-picture?"),
|
||||
|
@ -2564,7 +2564,7 @@ impl Renderer {
|
|||
// target is already bound.
|
||||
let cache_draw_target = DrawTarget::from_texture(
|
||||
cache_texture,
|
||||
readback_layer.0 as usize,
|
||||
0,
|
||||
false,
|
||||
);
|
||||
|
||||
|
@ -2643,15 +2643,15 @@ impl Renderer {
|
|||
// TODO(gw): For now, we don't bother batching these by source texture.
|
||||
// If if ever shows up as an issue, we can easily batch them.
|
||||
for blit in blits {
|
||||
let (source, layer, source_rect) = {
|
||||
let (source, source_rect) = {
|
||||
// A blit from the child render task into this target.
|
||||
// TODO(gw): Support R8 format here once we start
|
||||
// creating mips for alpha masks.
|
||||
let task = &render_tasks[blit.source];
|
||||
let (source_rect, layer) = task.get_target_rect();
|
||||
let source_rect = task.get_target_rect();
|
||||
let source_texture = task.get_texture_source();
|
||||
|
||||
(source_texture, layer.0, source_rect)
|
||||
(source_texture, source_rect)
|
||||
};
|
||||
|
||||
debug_assert_eq!(source_rect.size, blit.target_rect.size);
|
||||
|
@ -2665,7 +2665,7 @@ impl Renderer {
|
|||
|
||||
let read_target = DrawTarget::from_texture(
|
||||
texture,
|
||||
layer,
|
||||
0,
|
||||
false,
|
||||
);
|
||||
|
||||
|
@ -3273,13 +3273,14 @@ impl Renderer {
|
|||
(CompositeSurfaceFormat::Rgba, image_buffer_kind),
|
||||
)
|
||||
}
|
||||
CompositeTileSurface::Texture { surface: ResolvedSurfaceTexture::TextureCache { texture, layer } } => {
|
||||
CompositeTileSurface::Texture { surface: ResolvedSurfaceTexture::TextureCache { texture } } => {
|
||||
let layer = 0.0;
|
||||
(
|
||||
CompositeInstance::new(
|
||||
tile.rect,
|
||||
clip_rect,
|
||||
PremultipliedColorF::WHITE,
|
||||
layer as f32,
|
||||
layer,
|
||||
tile.z_id,
|
||||
),
|
||||
BatchTextures::composite_rgb(texture),
|
||||
|
@ -3764,7 +3765,7 @@ impl Renderer {
|
|||
|
||||
let zero_color = [0.0, 0.0, 0.0, 0.0];
|
||||
for &task_id in &target.zero_clears {
|
||||
let (rect, _) = render_tasks[task_id].get_target_rect();
|
||||
let rect = render_tasks[task_id].get_target_rect();
|
||||
self.device.clear_target(
|
||||
Some(zero_color),
|
||||
None,
|
||||
|
@ -3774,7 +3775,7 @@ impl Renderer {
|
|||
|
||||
let one_color = [1.0, 1.0, 1.0, 1.0];
|
||||
for &task_id in &target.one_clears {
|
||||
let (rect, _) = render_tasks[task_id].get_target_rect();
|
||||
let rect = render_tasks[task_id].get_target_rect();
|
||||
self.device.clear_target(
|
||||
Some(one_color),
|
||||
None,
|
||||
|
@ -4399,10 +4400,10 @@ impl Renderer {
|
|||
// cache targets have already been updated and can be
|
||||
// skipped this time.
|
||||
if !frame.has_been_rendered {
|
||||
for (&(texture_id, target_index), target) in &pass.texture_cache {
|
||||
for (&texture_id, target) in &pass.texture_cache {
|
||||
self.draw_texture_cache_target(
|
||||
&texture_id,
|
||||
target_index,
|
||||
0,
|
||||
target,
|
||||
&frame.render_tasks,
|
||||
&mut results.stats,
|
||||
|
@ -4418,14 +4419,14 @@ impl Renderer {
|
|||
results.stats.color_target_count += 1;
|
||||
|
||||
let draw_target = match picture_target.surface {
|
||||
ResolvedSurfaceTexture::TextureCache { ref texture, layer } => {
|
||||
ResolvedSurfaceTexture::TextureCache { ref texture } => {
|
||||
let (texture, _) = self.texture_resolver
|
||||
.resolve(texture)
|
||||
.expect("bug");
|
||||
|
||||
DrawTarget::from_texture(
|
||||
texture,
|
||||
layer as usize,
|
||||
0,
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче