Reach a compiling workspace on the merged tree

This commit is contained in:
Dennis Kobert
2026-09-08 16:11:30 +00:00
parent a854c25eb8
commit 3830ace926
17 changed files with 133 additions and 113 deletions
+12 -12
View File
@@ -12,16 +12,16 @@ use core_types::{ATTR_TRANSFORM, Ctx, ExtractFootprint};
use graphic_types::Graphic;
use pipeline::{BasicBrushPipeline, BasicBrushPipelineArgs};
use raster_types::{GPU, Raster};
use wgpu_executor::{WgpuExecutor, WgpuPipelineCache};
use core_types::ProtoNodeIdentifier;
use wgpu_executor::{WgpuExecutorHandle, WgpuPipelineCache};
#[node_macro::node(category("Raster: Brush"))]
pub async fn basic_brush<'a: 'n>(
pub fn basic_brush(
ctx: impl Ctx + ExtractFootprint,
strokes: List<Graphic>,
#[widget(ParsedWidgetOverride::Hidden)] cache: Item<BrushCache>,
#[scope(basic_brush_pipeline::IDENTIFIER)] pipeline: Item<WgpuPipelineCache>,
strokes: List<Graphic<'static>>,
#[widget(ParsedWidgetOverride::Hidden)] cache: BrushCache,
#[scope(basic_brush_pipeline::IDENTIFIER)] pipeline: WgpuPipelineCache,
) -> List<Raster<GPU>> {
let (cache, pipeline) = (cache.into_element(), pipeline.into_element());
let mut stack = vec![strokes.into_iter()];
let mut strokes = Vec::new();
while let Some(top) = stack.last_mut() {
@@ -56,7 +56,7 @@ pub async fn basic_brush<'a: 'n>(
strokes: &strokes,
cache: &cache,
};
let Some((texture, transform)) = pipeline.run::<BasicBrushPipeline>(&args).await else {
let Some((texture, transform)) = pipeline.run::<BasicBrushPipeline>(&args) else {
return List::new();
};
let raster = Raster::<GPU>::new_gpu(texture);
@@ -64,11 +64,11 @@ pub async fn basic_brush<'a: 'n>(
}
#[node_macro::node(category(""), inject_scope)]
async fn basic_brush_pipeline<'a: 'n>(
fn basic_brush_pipeline(
_ctx: impl Ctx,
#[scope(ProtoNodeIdentifier::new("graphene_std::platform_application_io::WgpuExecutorNode"))] executor: Item<&'a WgpuExecutor>,
#[scope(ProtoNodeIdentifier::new("graphene_std::platform_application_io::WgpuExecutorNode"))] executor: WgpuExecutorHandle,
#[data] pipeline: WgpuPipelineCache,
) -> Item<WgpuPipelineCache> {
executor.into_element().pipeline_init::<BasicBrushPipeline>(pipeline);
Item::new_from_element(pipeline.clone())
) -> WgpuPipelineCache {
executor.pipeline_init::<BasicBrushPipeline>(pipeline);
pipeline.clone()
}
@@ -9,7 +9,7 @@ use core_types::Color;
use core_types::transform::Footprint;
use glam::{DAffine2, UVec2};
use raster_types::Texture;
use wgpu_executor::{AsyncWgpuPipeline, Buffer, WgpuExecutor};
use wgpu_executor::{Buffer, WgpuExecutor, WgpuPipeline};
pub(super) const DENSITY_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::R16Float;
pub(super) const COMPOSITE_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba16Float;
@@ -71,7 +71,7 @@ pub struct BasicBrushPipelineArgs<'a> {
pub(super) cache: &'a BrushCache,
}
impl AsyncWgpuPipeline for BasicBrushPipeline {
impl WgpuPipeline for BasicBrushPipeline {
type Args<'a> = BasicBrushPipelineArgs<'a>;
type Out = Option<(Texture, DAffine2)>;
@@ -85,7 +85,7 @@ impl AsyncWgpuPipeline for BasicBrushPipeline {
}
}
async fn run<'a>(&'a self, executor: &'a WgpuExecutor, args: &'a Self::Args<'_>) -> Self::Out {
fn run<'a>(&'a self, executor: &'a WgpuExecutor, args: &'a Self::Args<'_>) -> Self::Out {
let frame = super::render::Frame::new(args.strokes)?;
let region = Region::new(&args.footprint)?;
let state = args.cache.take(&args.footprint).unwrap_or_default();
+4 -5
View File
@@ -17,11 +17,10 @@ fn brush_strokes(
_: impl Ctx,
strokes: List<Stroke>,
color: List<Color>,
#[default(DEFAULT_DIAMETER)] diameter: Item<f64>,
#[default(DEFAULT_HARDNESS)] hardness: Item<Percentage>,
#[default(DEFAULT_FLOW)] flow: Item<Percentage>,
) -> List<Graphic> {
let (diameter, hardness, flow) = (diameter.into_element(), hardness.into_element(), flow.into_element());
#[default(DEFAULT_DIAMETER)] diameter: f64,
#[default(DEFAULT_HARDNESS)] hardness: Percentage,
#[default(DEFAULT_FLOW)] flow: Percentage,
) -> List<Graphic<'static>> {
List::new_from_item(
Item::new_from_element(Graphic::from(strokes))
.with_attribute(ATTR_COLOR, color.element(0).copied().unwrap_or_default())