mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
add function to render directly from an encoding
This commit is contained in:
parent
520f6d0d41
commit
ec956d859b
|
@ -3,6 +3,7 @@
|
||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
encoding::Encoding,
|
||||||
engine::{BufProxy, ImageFormat, ImageProxy, Recording, ResourceProxy},
|
engine::{BufProxy, ImageFormat, ImageProxy, Recording, ResourceProxy},
|
||||||
shaders::{self, FullShaders, Shaders},
|
shaders::{self, FullShaders, Shaders},
|
||||||
Scene,
|
Scene,
|
||||||
|
@ -134,12 +135,20 @@ pub fn render_full(
|
||||||
shaders: &FullShaders,
|
shaders: &FullShaders,
|
||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
|
) -> (Recording, ResourceProxy) {
|
||||||
|
render_encoding_full(&scene.data(), shaders, width, height)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render_encoding_full(
|
||||||
|
data: &Encoding,
|
||||||
|
shaders: &FullShaders,
|
||||||
|
width: u32,
|
||||||
|
height: u32,
|
||||||
) -> (Recording, ResourceProxy) {
|
) -> (Recording, ResourceProxy) {
|
||||||
use crate::encoding::{resource::ResourceCache, PackedEncoding};
|
use crate::encoding::{resource::ResourceCache, PackedEncoding};
|
||||||
let mut recording = Recording::default();
|
let mut recording = Recording::default();
|
||||||
let mut resources = ResourceCache::new();
|
let mut resources = ResourceCache::new();
|
||||||
let mut packed_scene = PackedEncoding::default();
|
let mut packed_scene = PackedEncoding::default();
|
||||||
let data = scene.data();
|
|
||||||
packed_scene.pack(&data, &mut resources);
|
packed_scene.pack(&data, &mut resources);
|
||||||
let (ramp_data, ramps_width, ramps_height) = resources.ramps(packed_scene.resources).unwrap();
|
let (ramp_data, ramps_width, ramps_height) = resources.ramps(packed_scene.resources).unwrap();
|
||||||
let gradient_image = if data.patches.is_empty() {
|
let gradient_image = if data.patches.is_empty() {
|
||||||
|
|
Loading…
Reference in a new issue