shaders: codegen for per_pixel_adjust shader nodes

This commit is contained in:
firestar99 2025-07-30 17:38:09 +02:00
parent d5f11df9dd
commit 6efd199c84
7 changed files with 179 additions and 6 deletions

View file

@ -1,7 +1,7 @@
use crate::parsing::*;
use convert_case::{Case, Casing};
use proc_macro_crate::FoundCrate;
use proc_macro2::TokenStream as TokenStream2;
use proc_macro2::{TokenStream as TokenStream2, TokenStream};
use quote::{ToTokens, format_ident, quote, quote_spanned};
use std::sync::atomic::AtomicU64;
use syn::punctuated::Punctuated;
@ -295,6 +295,7 @@ pub(crate) fn generate_node_code(parsed: &ParsedNodeFn) -> syn::Result<TokenStre
let cfg = crate::shader_nodes::modify_cfg(attributes);
let node_input_accessor = generate_node_input_references(parsed, fn_generics, &field_idents, &graphene_core, &identifier, &cfg);
let shader_entry_point = attributes.shader_node.as_ref().map(|n| n.codegen_shader_entry_point(parsed)).unwrap_or(Ok(TokenStream::new()))?;
Ok(quote! {
/// Underlying implementation for [#struct_name]
#[inline]
@ -384,6 +385,8 @@ pub(crate) fn generate_node_code(parsed: &ParsedNodeFn) -> syn::Result<TokenStre
NODE_METADATA.lock().unwrap().insert(#identifier(), metadata);
}
}
#shader_entry_point
})
}
@ -586,6 +589,7 @@ fn generate_register_node_impl(parsed: &ParsedNodeFn, field_names: &[&Ident], st
})
}
use crate::shader_nodes::CodegenShaderEntryPoint;
use syn::visit_mut::VisitMut;
use syn::{GenericArgument, Lifetime, Type};