mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-08 20:01:30 +11:00
Add a clear_color uniform
Introduced an RGBA8 config parameter to apply as a base blend color in the fine stage of the full pipeline.
This commit is contained in:
parent
61ae3cde03
commit
8eabc12a72
|
@ -187,6 +187,9 @@ fn main(
|
|||
let xy = vec2(f32(global_id.x * PIXELS_PER_THREAD), f32(global_id.y));
|
||||
#ifdef full
|
||||
var rgba: array<vec4<f32>, PIXELS_PER_THREAD>;
|
||||
for (var i = 0u; i < PIXELS_PER_THREAD; i += 1u) {
|
||||
rgba[i] = unpack4x8unorm(config.clear_color).wzyx;
|
||||
}
|
||||
var blend_stack: array<array<u32, PIXELS_PER_THREAD>, BLEND_STACK_SPLIT>;
|
||||
var clip_depth = 0u;
|
||||
var area: array<f32, PIXELS_PER_THREAD>;
|
||||
|
|
|
@ -7,6 +7,11 @@ struct Config {
|
|||
target_width: u32,
|
||||
target_height: u32,
|
||||
|
||||
// The initial color applied to the pixels in a tile during the fine stage.
|
||||
// This is only used in the full pipeline. The format is packed RGBA8 in MSB
|
||||
// order.
|
||||
clear_color: u32,
|
||||
|
||||
n_drawobj: u32,
|
||||
n_path: u32,
|
||||
n_clip: u32,
|
||||
|
|
|
@ -60,6 +60,8 @@ pub struct Config {
|
|||
pub target_width: u32,
|
||||
/// Height of the target in pixels.
|
||||
pub target_height: u32,
|
||||
/// The initial background color applied to the target
|
||||
pub clear_color: u32,
|
||||
/// Layout of packed scene data.
|
||||
pub layout: Layout,
|
||||
/// Size of binning buffer allocation (in u32s).
|
||||
|
|
|
@ -5,6 +5,7 @@ use bytemuck::{Pod, Zeroable};
|
|||
use crate::{
|
||||
encoding::Encoding,
|
||||
engine::{BufProxy, ImageFormat, ImageProxy, Recording, ResourceProxy},
|
||||
peniko::Color,
|
||||
shaders::{self, FullShaders, Shaders},
|
||||
Scene,
|
||||
};
|
||||
|
@ -21,6 +22,8 @@ pub struct Render {
|
|||
ptcl_size: u32,
|
||||
width_in_tiles: u32,
|
||||
height_in_tiles: u32,
|
||||
/// The background color applied to the target
|
||||
clear_color: Color,
|
||||
fine: Option<FineResources>,
|
||||
}
|
||||
|
||||
|
@ -61,6 +64,7 @@ struct Config {
|
|||
height_in_tiles: u32,
|
||||
target_width: u32,
|
||||
target_height: u32,
|
||||
clear_color: u32,
|
||||
n_drawobj: u32,
|
||||
n_path: u32,
|
||||
n_clip: u32,
|
||||
|
@ -216,6 +220,7 @@ impl Render {
|
|||
ptcl_size: (1 << 25) / 4 as u32,
|
||||
width_in_tiles: 0,
|
||||
height_in_tiles: 0,
|
||||
clear_color: Color::BLACK,
|
||||
fine: None,
|
||||
}
|
||||
}
|
||||
|
@ -265,6 +270,7 @@ impl Render {
|
|||
height_in_tiles: new_height / 16,
|
||||
target_width: width,
|
||||
target_height: height,
|
||||
clear_color: self.clear_color.to_premul_u32(),
|
||||
binning_size: self.binning_info_size - info_size,
|
||||
tiles_size: self.tiles_size,
|
||||
segments_size: self.segments_size,
|
||||
|
|
Loading…
Reference in a new issue