mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-18 17:08:17 +08:00
Shaders: rust-gpu integration to compile shader nodes to WGSL (#3097)
* shaders: shader compilation setup * nix: use rustc_codegen_spirv.so from nix * shaders: codegen for per_pixel_adjust shader nodes * shaders: disable nodes needing bool * shaders: `#[repr(u32)]` some enums * shaders: add lint ignores from rust-gpu * shaders: fix node-macro tests * gcore-shaders: toml cleanup * shader-nodes feature: put rust-gpu to wgsl compile behind feature gate * shaders: fix use TokenStream2 * shaders: allow providing shader externally * Update iai runner in workflow --------- Co-authored-by: Timon Schelling <me@timon.zip> Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
@@ -3,6 +3,7 @@ use super::discrete_srgb::{float_to_srgb_u8, srgb_u8_to_float};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use core::fmt::Debug;
|
||||
use core::hash::Hash;
|
||||
use glam::Vec4;
|
||||
use half::f16;
|
||||
#[cfg(not(feature = "std"))]
|
||||
use num_traits::Euclid;
|
||||
@@ -1075,6 +1076,21 @@ impl Color {
|
||||
..*self
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub const fn from_vec4(vec: Vec4) -> Self {
|
||||
Self {
|
||||
red: vec.x,
|
||||
green: vec.y,
|
||||
blue: vec.z,
|
||||
alpha: vec.w,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn to_vec4(&self) -> Vec4 {
|
||||
Vec4::new(self.red, self.green, self.blue, self.alpha)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user