mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 07:18:04 +08:00
* Start implementing GpuExecutor for wgpu * Implement read_output_buffer function * Implement extraction node in the compiler * Generate type annotations during shader compilation * Start adding node wrapprs for graph execution api * Wrap more of the api in nodes * Restructure Pipeline to accept arbitrary shader inputs * Adapt nodes to new trait definitions * Start implementing gpu-compiler trait * Adapt shader generation * Hardstuck on pointer casts * Pass nodes as references in gpu code to avoid zsts * Update gcore to compile on the gpu * Fix color doc tests * Impl Node for node refs
21 lines
464 B
Rust
21 lines
464 B
Rust
use crate::{raster::Sample, Color};
|
|
|
|
use bytemuck::{Pod, Zeroable};
|
|
use spirv_std::image::{Image2d, SampledImage};
|
|
|
|
#[repr(C)]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Pod, Zeroable)]
|
|
pub struct PushConstants {
|
|
pub n: u32,
|
|
pub node: u32,
|
|
}
|
|
|
|
impl Sample for SampledImage<Image2d> {
|
|
type Pixel = Color;
|
|
|
|
fn sample(&self, pos: glam::DVec2) -> Option<Self::Pixel> {
|
|
let color = self.sample(pos);
|
|
Color::from_rgbaf32(color.x, color.y, color.z, color.w)
|
|
}
|
|
}
|