mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-29 04:08:12 +08:00
Address pr review
This commit is contained in:
@@ -17,7 +17,7 @@ fn execute_to_final(executor: &DynamicExecutor, render_config: RenderConfig) ->
|
|||||||
GPoll::Final(value) => Ok(value),
|
GPoll::Final(value) => Ok(value),
|
||||||
GPoll::Fallback(boxed) => {
|
GPoll::Fallback(boxed) => {
|
||||||
let (value, error) = *boxed;
|
let (value, error) = *boxed;
|
||||||
log::error!("Node graph evaluation reported an error alongside its fallback output: {error:?}");
|
log::warn!("Node graph evaluation reported an error alongside its fallback output: {error:?}");
|
||||||
Ok(value)
|
Ok(value)
|
||||||
}
|
}
|
||||||
GPoll::Partial(_) | GPoll::Pending => Err("Node graph evaluation did not complete".into()),
|
GPoll::Partial(_) | GPoll::Pending => Err("Node graph evaluation did not complete".into()),
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ pub fn simplify_identifier_name(ty: &str) -> String {
|
|||||||
/// Converts a Rust-internal type name to its user-facing form.
|
/// Converts a Rust-internal type name to its user-facing form.
|
||||||
pub fn make_type_user_readable(ty: &str) -> String {
|
pub fn make_type_user_readable(ty: &str) -> String {
|
||||||
let ty = ty
|
let ty = ty
|
||||||
.replace("Option<Arc<OwnedContextImpl>>", "Context")
|
.replace("ContextImpl", "Context")
|
||||||
.replace("Raster<CPU>", "Raster")
|
.replace("Raster<CPU>", "Raster")
|
||||||
.replace("Raster<GPU>", "Raster")
|
.replace("Raster<GPU>", "Raster")
|
||||||
.replace("DAffine2", "Transform")
|
.replace("DAffine2", "Transform")
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use core_types::shaders::buffer_struct::BufferStruct;
|
|||||||
use raster_types::{GPU, Raster};
|
use raster_types::{GPU, Raster};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Mutex;
|
use std::sync::{Mutex, PoisonError};
|
||||||
use wgpu::util::{BufferInitDescriptor, DeviceExt};
|
use wgpu::util::{BufferInitDescriptor, DeviceExt};
|
||||||
use wgpu::{
|
use wgpu::{
|
||||||
BindGroupDescriptor, BindGroupEntry, BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingResource, BindingType, Buffer, BufferBinding, BufferBindingType, BufferUsages, ColorTargetState, Face,
|
BindGroupDescriptor, BindGroupEntry, BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingResource, BindingType, Buffer, BufferBinding, BufferBindingType, BufferUsages, ColorTargetState, Face,
|
||||||
@@ -34,7 +34,7 @@ impl PerPixelAdjustShaderRuntime {
|
|||||||
|
|
||||||
impl ShaderRuntime {
|
impl ShaderRuntime {
|
||||||
pub fn run_per_pixel_adjust<T: BufferStruct>(&self, shaders: &Shaders<'_>, textures: List<Raster<GPU>>, args: Option<&T>) -> List<Raster<GPU>> {
|
pub fn run_per_pixel_adjust<T: BufferStruct>(&self, shaders: &Shaders<'_>, textures: List<Raster<GPU>>, args: Option<&T>) -> List<Raster<GPU>> {
|
||||||
let mut cache = self.per_pixel_adjust.pipeline_cache.lock().unwrap();
|
let mut cache = self.per_pixel_adjust.pipeline_cache.lock().unwrap_or_else(PoisonError::into_inner);
|
||||||
let pipeline = cache
|
let pipeline = cache
|
||||||
.entry(shaders.fragment_shader_name.to_owned())
|
.entry(shaders.fragment_shader_name.to_owned())
|
||||||
.or_insert_with(|| PerPixelAdjustGraphicsPipeline::new(&self.context, shaders));
|
.or_insert_with(|| PerPixelAdjustGraphicsPipeline::new(&self.context, shaders));
|
||||||
|
|||||||
@@ -231,9 +231,9 @@ impl PerPixelAdjustCodegen<'_> {
|
|||||||
description: "".to_string(),
|
description: "".to_string(),
|
||||||
widget_override: Default::default(),
|
widget_override: Default::default(),
|
||||||
ty: ParsedFieldType::Regular(RegularParsedField {
|
ty: ParsedFieldType::Regular(RegularParsedField {
|
||||||
ty: parse_quote!(std::sync::Arc<WgpuExecutor>),
|
ty: parse_quote!(#wgpu_executor::WgpuExecutorHandle),
|
||||||
exposed: true,
|
exposed: true,
|
||||||
value_source: ParsedValueSource::Scope(Box::new(parse_quote!("graphene_std::platform_application_io::WgpuExecutorArcNode"))),
|
value_source: ParsedValueSource::Scope(Box::new(parse_quote!("graphene_std::platform_application_io::WgpuExecutorNode"))),
|
||||||
number_soft_min: None,
|
number_soft_min: None,
|
||||||
number_soft_max: None,
|
number_soft_max: None,
|
||||||
number_hard_min: None,
|
number_hard_min: None,
|
||||||
|
|||||||
@@ -24,6 +24,15 @@ pub fn validate_node_fn(parsed: &ParsedNodeFn) -> syn::Result<()> {
|
|||||||
fn validate_async_source(parsed: &ParsedNodeFn) {
|
fn validate_async_source(parsed: &ParsedNodeFn) {
|
||||||
let snapshot_ctx = matches!(&parsed.input.ty, Type::Path(path) if path.path.segments.last().is_some_and(|segment| segment.ident == "CtxSnapshot"));
|
let snapshot_ctx = matches!(&parsed.input.ty, Type::Path(path) if path.path.segments.last().is_some_and(|segment| segment.ident == "CtxSnapshot"));
|
||||||
let future_kernel = crate::codegen::is_source_kernel(&parsed.output_type);
|
let future_kernel = crate::codegen::is_source_kernel(&parsed.output_type);
|
||||||
|
if let Some(placeholder) = &parsed.attributes.placeholder
|
||||||
|
&& !parsed.is_async
|
||||||
|
&& !future_kernel
|
||||||
|
{
|
||||||
|
emit_error!(
|
||||||
|
placeholder.span(),
|
||||||
|
"`placeholder` applies only to async and source kernels; a synchronous node never reports `Partial`, so the stand-in is unused"
|
||||||
|
);
|
||||||
|
}
|
||||||
if parsed.is_async && future_kernel {
|
if parsed.is_async && future_kernel {
|
||||||
emit_error!(
|
emit_error!(
|
||||||
parsed.output_type.span(),
|
parsed.output_type.span(),
|
||||||
|
|||||||
Reference in New Issue
Block a user