mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-08 14:48:12 +08:00
Fix
This commit is contained in:
@@ -73,7 +73,7 @@ pub fn wrap_network_in_scope(network: NodeNetwork, editor_api: Arc<PlatformEdito
|
|||||||
DocumentNode {
|
DocumentNode {
|
||||||
call_argument: concrete!(Context),
|
call_argument: concrete!(Context),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
NodeInput::scope(graphene_std::render_background::composit_background_pipeline::IDENTIFIER),
|
NodeInput::scope(graphene_std::render_background::composite_background_pipeline::IDENTIFIER),
|
||||||
NodeInput::node(NodeId(3), 0),
|
NodeInput::node(NodeId(3), 0),
|
||||||
],
|
],
|
||||||
implementation: DocumentNodeImplementation::ProtoNode(graphene_std::render_background::render_background::IDENTIFIER),
|
implementation: DocumentNodeImplementation::ProtoNode(graphene_std::render_background::render_background::IDENTIFIER),
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use wgpu_executor::{AsyncWgpuPipeline, WgpuExecutor, WgpuPipelineCache};
|
|||||||
#[node_macro::node(category(""))]
|
#[node_macro::node(category(""))]
|
||||||
async fn render_background<'a: 'n>(
|
async fn render_background<'a: 'n>(
|
||||||
ctx: impl Ctx + ExtractFootprint + ExtractVarArgs,
|
ctx: impl Ctx + ExtractFootprint + ExtractVarArgs,
|
||||||
#[scope(composit_background_pipeline::IDENTIFIER)] pipeline: WgpuPipelineCache,
|
#[scope(composite_background_pipeline::IDENTIFIER)] pipeline: WgpuPipelineCache,
|
||||||
data: RenderOutput,
|
data: RenderOutput,
|
||||||
) -> RenderOutput {
|
) -> RenderOutput {
|
||||||
let footprint = ctx.footprint();
|
let footprint = ctx.footprint();
|
||||||
@@ -36,7 +36,7 @@ async fn render_background<'a: 'n>(
|
|||||||
RenderOutputType::Texture(foreground_texture) => {
|
RenderOutputType::Texture(foreground_texture) => {
|
||||||
let doc_to_screen = (glam::DAffine2::from_scale(glam::DVec2::splat(render_params.scale)) * render_params.footprint.transform).as_affine2();
|
let doc_to_screen = (glam::DAffine2::from_scale(glam::DVec2::splat(render_params.scale)) * render_params.footprint.transform).as_affine2();
|
||||||
let blended = pipeline
|
let blended = pipeline
|
||||||
.run::<CompositBackground>(&CompositBackgroundArgs {
|
.run::<CompositeBackground>(&CompositeBackgroundArgs {
|
||||||
foreground: foreground_texture.as_ref(),
|
foreground: foreground_texture.as_ref(),
|
||||||
backgrounds: &metadata.backgrounds,
|
backgrounds: &metadata.backgrounds,
|
||||||
document_to_screen: doc_to_screen,
|
document_to_screen: doc_to_screen,
|
||||||
@@ -118,18 +118,18 @@ async fn render_background<'a: 'n>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[node_macro::node(category(""), inject_scope)]
|
#[node_macro::node(category(""), inject_scope)]
|
||||||
async fn composit_background_pipeline<'a: 'n>(
|
async fn composite_background_pipeline<'a: 'n>(
|
||||||
_ctx: impl Ctx,
|
_ctx: impl Ctx,
|
||||||
#[scope(crate::platform_application_io::try_wgpu_executor::IDENTIFIER)] executor: Option<&'a WgpuExecutor>,
|
#[scope(crate::platform_application_io::try_wgpu_executor::IDENTIFIER)] executor: Option<&'a WgpuExecutor>,
|
||||||
#[data] pipeline: WgpuPipelineCache,
|
#[data] pipeline: WgpuPipelineCache,
|
||||||
) -> WgpuPipelineCache {
|
) -> WgpuPipelineCache {
|
||||||
if let Some(executor) = executor {
|
if let Some(executor) = executor {
|
||||||
executor.pipeline_init::<CompositBackground>(pipeline);
|
executor.pipeline_init::<CompositeBackground>(pipeline);
|
||||||
}
|
}
|
||||||
pipeline.clone()
|
pipeline.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CompositBackground {
|
pub struct CompositeBackground {
|
||||||
checker_rect_pipeline: wgpu::RenderPipeline,
|
checker_rect_pipeline: wgpu::RenderPipeline,
|
||||||
checker_viewport_pipeline: wgpu::RenderPipeline,
|
checker_viewport_pipeline: wgpu::RenderPipeline,
|
||||||
fullscreen_pipeline: wgpu::RenderPipeline,
|
fullscreen_pipeline: wgpu::RenderPipeline,
|
||||||
@@ -138,15 +138,15 @@ pub struct CompositBackground {
|
|||||||
sampler: wgpu::Sampler,
|
sampler: wgpu::Sampler,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CompositBackgroundArgs<'a> {
|
pub struct CompositeBackgroundArgs<'a> {
|
||||||
foreground: &'a wgpu::Texture,
|
foreground: &'a wgpu::Texture,
|
||||||
backgrounds: &'a [rendering::Background],
|
backgrounds: &'a [rendering::Background],
|
||||||
document_to_screen: Affine2,
|
document_to_screen: Affine2,
|
||||||
zoom: f32,
|
zoom: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsyncWgpuPipeline for CompositBackground {
|
impl AsyncWgpuPipeline for CompositeBackground {
|
||||||
type Args<'a> = CompositBackgroundArgs<'a>;
|
type Args<'a> = CompositeBackgroundArgs<'a>;
|
||||||
type Out = Arc<wgpu::Texture>;
|
type Out = Arc<wgpu::Texture>;
|
||||||
|
|
||||||
fn create(executor: &WgpuExecutor) -> Self {
|
fn create(executor: &WgpuExecutor) -> Self {
|
||||||
@@ -329,7 +329,7 @@ impl AsyncWgpuPipeline for CompositBackground {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn run<'a>(&'a self, executor: &'a WgpuExecutor, args: &'a Self::Args<'_>) -> Self::Out {
|
async fn run<'a>(&'a self, executor: &'a WgpuExecutor, args: &'a Self::Args<'_>) -> Self::Out {
|
||||||
let &CompositBackgroundArgs {
|
let &CompositeBackgroundArgs {
|
||||||
foreground,
|
foreground,
|
||||||
backgrounds,
|
backgrounds,
|
||||||
document_to_screen,
|
document_to_screen,
|
||||||
@@ -439,7 +439,7 @@ impl AsyncWgpuPipeline for CompositBackground {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CompositBackground {
|
impl CompositeBackground {
|
||||||
fn create_checker_bind_group(&self, device: &wgpu::Device, uniforms: CompositeUniforms) -> wgpu::BindGroup {
|
fn create_checker_bind_group(&self, device: &wgpu::Device, uniforms: CompositeUniforms) -> wgpu::BindGroup {
|
||||||
let buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
let buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||||
label: Some("background_checker_uniforms"),
|
label: Some("background_checker_uniforms"),
|
||||||
|
|||||||
Reference in New Issue
Block a user